summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/extra/binlog_tests/binlog.test29
-rw-r--r--mysql-test/extra/binlog_tests/binlog_insert_delayed.test4
-rw-r--r--mysql-test/extra/binlog_tests/blackhole.test11
-rw-r--r--mysql-test/extra/binlog_tests/ctype_cp932_binlog.test4
-rw-r--r--mysql-test/extra/binlog_tests/ctype_ucs_binlog.test3
-rw-r--r--mysql-test/extra/binlog_tests/drop_temp_table.test5
-rw-r--r--mysql-test/extra/binlog_tests/insert_select-binlog.test8
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test57
-rw-r--r--mysql-test/extra/rpl_tests/rpl_ddl.test395
-rw-r--r--mysql-test/extra/rpl_tests/rpl_deadlock.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test16
-rw-r--r--mysql-test/extra/rpl_tests/rpl_max_relay_size.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_multi_query.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_ndb_ddl.test507
-rw-r--r--mysql-test/extra/rpl_tests/rpl_relayrotate.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_charset.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp002.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp003.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_charset.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_truncate_helper.test4
-rw-r--r--mysql-test/include/federated.inc5
-rw-r--r--mysql-test/include/federated_cleanup.inc2
-rw-r--r--mysql-test/include/gis_generic.inc71
-rw-r--r--mysql-test/include/have_query_cache.inc3
-rw-r--r--mysql-test/include/ndb_backup_print.inc6
-rw-r--r--mysql-test/include/not_embedded.inc2
-rw-r--r--mysql-test/include/rpl_events.inc119
-rw-r--r--mysql-test/include/rpl_stmt_seq.inc114
-rw-r--r--mysql-test/include/rpl_stmt_seq2.inc201
-rw-r--r--mysql-test/include/rpl_udf.inc189
-rw-r--r--mysql-test/include/show_binlog_events.inc4
-rw-r--r--mysql-test/include/show_binlog_events2.inc9
-rw-r--r--mysql-test/include/wait_condition.inc17
-rw-r--r--mysql-test/install_test_db.sh17
-rw-r--r--mysql-test/lib/mtr_cases.pl15
-rw-r--r--mysql-test/lib/mtr_process.pl45
-rwxr-xr-xmysql-test/mysql-test-run.pl289
-rw-r--r--mysql-test/ndb/ndbcluster.sh2
-rw-r--r--mysql-test/r/alter_table.result36
-rw-r--r--mysql-test/r/archive.result9
-rw-r--r--mysql-test/r/archive_gis.result88
-rw-r--r--mysql-test/r/binlog_row_binlog.result112
-rw-r--r--mysql-test/r/binlog_row_blackhole.result44
-rw-r--r--mysql-test/r/binlog_row_ctype_ucs.result6
-rw-r--r--mysql-test/r/binlog_row_drop_tmp_tbl.result5
-rw-r--r--mysql-test/r/binlog_row_insert_select.result10
-rw-r--r--mysql-test/r/binlog_row_mix_innodb_myisam.result284
-rw-r--r--mysql-test/r/binlog_statement_insert_delayed.result12
-rw-r--r--mysql-test/r/binlog_stm_binlog.result110
-rw-r--r--mysql-test/r/binlog_stm_blackhole.result44
-rw-r--r--mysql-test/r/binlog_stm_ctype_ucs.result6
-rw-r--r--mysql-test/r/binlog_stm_drop_tmp_tbl.result13
-rw-r--r--mysql-test/r/binlog_stm_insert_select.result8
-rw-r--r--mysql-test/r/binlog_stm_mix_innodb_myisam.result218
-rw-r--r--mysql-test/r/client_xml.result26
-rw-r--r--mysql-test/r/compress.result3
-rw-r--r--mysql-test/r/crash_commit_before.result1
-rw-r--r--mysql-test/r/create.result107
-rw-r--r--mysql-test/r/ctype_cp932_binlog_row.result8
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result20
-rw-r--r--mysql-test/r/ctype_uca.result9
-rw-r--r--mysql-test/r/ctype_ucs.result18
-rw-r--r--mysql-test/r/ctype_utf8.result55
-rw-r--r--mysql-test/r/date_formats.result79
-rw-r--r--mysql-test/r/delayed.result12
-rw-r--r--mysql-test/r/delete.result9
-rw-r--r--mysql-test/r/distinct.result14
-rw-r--r--mysql-test/r/endspace.result15
-rw-r--r--mysql-test/r/errors.result13
-rw-r--r--mysql-test/r/events.result497
-rw-r--r--mysql-test/r/events_bugs.result159
-rw-r--r--mysql-test/r/events_grant.result24
-rw-r--r--mysql-test/r/events_logs_tests.result2
-rw-r--r--mysql-test/r/events_restart_phase0.result22
-rw-r--r--mysql-test/r/events_restart_phase1.result22
-rw-r--r--mysql-test/r/events_restart_phase2.result48
-rw-r--r--mysql-test/r/events_restart_phase3.result10
-rw-r--r--mysql-test/r/events_scheduling.result54
-rw-r--r--mysql-test/r/events_time_zone.result149
-rw-r--r--mysql-test/r/events_trans.result118
-rw-r--r--mysql-test/r/events_trans_notembedded.result45
-rw-r--r--mysql-test/r/federated_server.result197
-rw-r--r--mysql-test/r/flush2.result18
-rw-r--r--mysql-test/r/flush_block_commit_notembedded.result4
-rw-r--r--mysql-test/r/fulltext_left_join.result7
-rw-r--r--mysql-test/r/func_gconcat.result10
-rw-r--r--mysql-test/r/func_group.result9
-rw-r--r--mysql-test/r/func_in.result5
-rw-r--r--mysql-test/r/func_sapdb.result6
-rw-r--r--mysql-test/r/func_str.result9
-rw-r--r--mysql-test/r/func_time.result10
-rw-r--r--mysql-test/r/gis-rtree.result562
-rw-r--r--mysql-test/r/gis.result105
-rw-r--r--mysql-test/r/grant.result132
-rw-r--r--mysql-test/r/group_by.result117
-rw-r--r--mysql-test/r/heap.result7
-rw-r--r--mysql-test/r/heap_btree.result27
-rw-r--r--mysql-test/r/help.result97
-rw-r--r--mysql-test/r/information_schema.result22
-rw-r--r--mysql-test/r/information_schema_db.result71
-rw-r--r--mysql-test/r/innodb.result18
-rw-r--r--mysql-test/r/innodb_gis.result88
-rw-r--r--mysql-test/r/insert_select.result29
-rw-r--r--mysql-test/r/insert_update.result100
-rw-r--r--mysql-test/r/key.result41
-rw-r--r--mysql-test/r/loaddata.result15
-rw-r--r--mysql-test/r/lock.result21
-rw-r--r--mysql-test/r/log_tables-big.result29
-rw-r--r--mysql-test/r/merge.result13
-rw-r--r--mysql-test/r/myisam.result150
-rw-r--r--mysql-test/r/mysql.result2
-rw-r--r--mysql-test/r/mysql_protocols.result1
-rw-r--r--mysql-test/r/mysqlbinlog.result14
-rw-r--r--mysql-test/r/mysqlbinlog2.result34
-rw-r--r--mysql-test/r/mysqldump.result121
-rw-r--r--mysql-test/r/mysqlslap.result24
-rw-r--r--mysql-test/r/ndb_binlog_ddl_multi.result112
-rw-r--r--mysql-test/r/ndb_binlog_discover.result17
-rw-r--r--mysql-test/r/ndb_binlog_ignore_db.result2
-rw-r--r--mysql-test/r/ndb_binlog_log_bin.result80
-rw-r--r--mysql-test/r/ndb_binlog_multi.result64
-rw-r--r--mysql-test/r/ndb_blob.result2
-rw-r--r--mysql-test/r/ndb_dd_basic.result35
-rw-r--r--mysql-test/r/ndb_gis.result180
-rw-r--r--mysql-test/r/ndb_partition_error2.result3
-rw-r--r--mysql-test/r/ndb_partition_key.result1
-rw-r--r--mysql-test/r/ndb_restore.result31
-rw-r--r--mysql-test/r/ndb_restore_compat.result8
-rw-r--r--mysql-test/r/ndb_restore_print.result321
-rw-r--r--mysql-test/r/ndb_single_user.result59
-rw-r--r--mysql-test/r/ndb_trigger.result171
-rw-r--r--mysql-test/r/openssl_1.result24
-rw-r--r--mysql-test/r/openssl_2.result25
-rw-r--r--mysql-test/r/order_by.result106
-rw-r--r--mysql-test/r/partition.result19
-rw-r--r--mysql-test/r/partition_grant.result11
-rw-r--r--mysql-test/r/ps.result51
-rw-r--r--mysql-test/r/ps_2myisam.result7
-rw-r--r--mysql-test/r/ps_3innodb.result7
-rw-r--r--mysql-test/r/ps_4heap.result7
-rw-r--r--mysql-test/r/ps_5merge.result14
-rw-r--r--mysql-test/r/ps_7ndb.result7
-rw-r--r--mysql-test/r/query_cache.result23
-rw-r--r--mysql-test/r/query_cache_sql_prepare.result204
-rw-r--r--mysql-test/r/range.result141
-rw-r--r--mysql-test/r/row.result31
-rw-r--r--mysql-test/r/rpl_000015.result16
-rw-r--r--mysql-test/r/rpl_change_master.result8
-rw-r--r--mysql-test/r/rpl_critical_errors.result1
-rw-r--r--mysql-test/r/rpl_critical_errors.result.txt56
-rw-r--r--mysql-test/r/rpl_ddl.result445
-rw-r--r--mysql-test/r/rpl_deadlock_innodb.result7
-rw-r--r--mysql-test/r/rpl_empty_master_crash.result2
-rw-r--r--mysql-test/r/rpl_events.result161
-rw-r--r--mysql-test/r/rpl_extraCol_innodb.result8
-rw-r--r--mysql-test/r/rpl_extraCol_myisam.result8
-rw-r--r--mysql-test/r/rpl_flushlog_loop.result5
-rw-r--r--mysql-test/r/rpl_ignore_table.result108
-rw-r--r--mysql-test/r/rpl_incident.result107
-rw-r--r--mysql-test/r/rpl_known_bugs_detection.result6
-rw-r--r--mysql-test/r/rpl_loaddata.result14
-rw-r--r--mysql-test/r/rpl_loaddata_s.result2
-rw-r--r--mysql-test/r/rpl_log_pos.result28
-rw-r--r--mysql-test/r/rpl_ndb_basic.result63
-rw-r--r--mysql-test/r/rpl_ndb_charset.result64
-rw-r--r--mysql-test/r/rpl_ndb_circular.result95
-rw-r--r--mysql-test/r/rpl_ndb_circular_simplex.result97
-rw-r--r--mysql-test/r/rpl_ndb_dd_basic.result24
-rw-r--r--mysql-test/r/rpl_ndb_ddl.result434
-rw-r--r--mysql-test/r/rpl_ndb_do_table.result4
-rw-r--r--mysql-test/r/rpl_ndb_extraCol.result62
-rw-r--r--mysql-test/r/rpl_ndb_idempotent.result12
-rw-r--r--mysql-test/r/rpl_ndb_log.result69
-rw-r--r--mysql-test/r/rpl_ndb_multi.result4
-rw-r--r--mysql-test/r/rpl_ndb_stm_innodb.result37
-rw-r--r--mysql-test/r/rpl_ndb_sync.result14
-rw-r--r--mysql-test/r/rpl_openssl.result31
-rw-r--r--mysql-test/r/rpl_packet.result15
-rw-r--r--mysql-test/r/rpl_rbr_to_sbr.result5
-rw-r--r--mysql-test/r/rpl_redirect.result2
-rw-r--r--mysql-test/r/rpl_replicate_do.result4
-rw-r--r--mysql-test/r/rpl_rotate_logs.result36
-rw-r--r--mysql-test/r/rpl_row_basic_11bugs-master.opt1
-rw-r--r--mysql-test/r/rpl_row_basic_11bugs-slave.opt1
-rw-r--r--mysql-test/r/rpl_row_basic_11bugs.result116
-rw-r--r--mysql-test/r/rpl_row_charset.result64
-rw-r--r--mysql-test/r/rpl_row_create_table.result110
-rw-r--r--mysql-test/r/rpl_row_delayed_ins.result19
-rw-r--r--mysql-test/r/rpl_row_drop.result8
-rw-r--r--mysql-test/r/rpl_row_flsh_tbls.result4
-rw-r--r--mysql-test/r/rpl_row_inexist_tbl.result3
-rw-r--r--mysql-test/r/rpl_row_log.result44
-rw-r--r--mysql-test/r/rpl_row_log_innodb.result48
-rw-r--r--mysql-test/r/rpl_row_max_relay_size.result28
-rw-r--r--mysql-test/r/rpl_row_reset_slave.result16
-rw-r--r--mysql-test/r/rpl_row_tabledefs_2myisam.result6
-rw-r--r--mysql-test/r/rpl_row_tabledefs_3innodb.result6
-rw-r--r--mysql-test/r/rpl_row_until.result16
-rw-r--r--mysql-test/r/rpl_server_id1.result4
-rw-r--r--mysql-test/r/rpl_server_id2.result4
-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_ssl.result5
-rw-r--r--mysql-test/r/rpl_ssl1.result146
-rw-r--r--mysql-test/r/rpl_stm_charset.result66
-rw-r--r--mysql-test/r/rpl_stm_flsh_tbls.result4
-rw-r--r--mysql-test/r/rpl_stm_log.result46
-rw-r--r--mysql-test/r/rpl_stm_max_relay_size.result28
-rw-r--r--mysql-test/r/rpl_stm_multi_query.result18
-rw-r--r--mysql-test/r/rpl_stm_reset_slave.result16
-rw-r--r--mysql-test/r/rpl_stm_until.result20
-rw-r--r--mysql-test/r/rpl_switch_stm_row_mixed.result948
-rw-r--r--mysql-test/r/rpl_truncate_2myisam.result72
-rw-r--r--mysql-test/r/rpl_truncate_3innodb.result96
-rw-r--r--mysql-test/r/rpl_truncate_7ndb.result72
-rw-r--r--mysql-test/r/rpl_udf.result310
-rw-r--r--mysql-test/r/select.result47
-rw-r--r--mysql-test/r/skip_grants.result14
-rw-r--r--mysql-test/r/sp-code.result19
-rw-r--r--mysql-test/r/sp-error.result56
-rw-r--r--mysql-test/r/sp-security.result35
-rw-r--r--mysql-test/r/sp.result318
-rw-r--r--mysql-test/r/sp_trans_log.result27
-rw-r--r--mysql-test/r/strict.result62
-rw-r--r--mysql-test/r/subselect.result163
-rw-r--r--mysql-test/r/subselect3.result51
-rw-r--r--mysql-test/r/system_mysql_db.result4
-rw-r--r--mysql-test/r/temp_table.result21
-rw-r--r--mysql-test/r/timezone2.result11
-rw-r--r--mysql-test/r/trigger.result42
-rw-r--r--mysql-test/r/truncate.result27
-rw-r--r--mysql-test/r/type_date.result28
-rw-r--r--mysql-test/r/type_datetime.result42
-rw-r--r--mysql-test/r/type_float.result8
-rw-r--r--mysql-test/r/type_newdecimal.result18
-rw-r--r--mysql-test/r/type_set.result19
-rw-r--r--mysql-test/r/type_year.result12
-rw-r--r--mysql-test/r/udf.result2
-rw-r--r--mysql-test/r/union.result12
-rw-r--r--mysql-test/r/user_var-binlog.result12
-rw-r--r--mysql-test/r/variables.result31
-rw-r--r--mysql-test/r/view.result18
-rw-r--r--mysql-test/r/view_grant.result151
-rw-r--r--mysql-test/r/windows.result15
-rw-r--r--mysql-test/r/xml.result7
-rw-r--r--mysql-test/suite/funcs_1/r/a_version_check.result2
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc93
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc53
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in4
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in4
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in4
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in45
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in4
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc39
-rw-r--r--mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result10887
-rw-r--r--mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result10887
-rw-r--r--mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result13724
-rw-r--r--mysql-test/suite/partitions/r/partition_t55.out68
-rw-r--r--mysql-test/suite/partitions/t/disabled.def2
-rw-r--r--mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test10
-rw-r--r--mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test6
-rw-r--r--mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test40
-rw-r--r--mysql-test/suite/row_lock/include/row_lock.inc83
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab.inc94
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc93
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc93
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_trig.inc96
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view.inc89
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_mix.inc92
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_storedp.inc126
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_trig.inc99
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_1.result142
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_2.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_3.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_4.result142
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_5.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result97
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result145
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result113
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result151
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result37
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result34
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result40
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result48
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result40
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result312
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result47
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result183
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result38
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_1.result139
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_2.result31
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_3.result30
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_4.result139
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_5.result30
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result177
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result357
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result255
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result148
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result35
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result194
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result200
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result169
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result38
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result309
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result46
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result180
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result36
-rw-r--r--mysql-test/suite/row_lock/readme.txt9
-rw-r--r--mysql-test/suite/row_lock/summary_of_sel_test.txt36
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_3.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_4.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_5.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_3.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_4.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_5.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test6
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result12
-rw-r--r--mysql-test/t/alter_table.test27
-rw-r--r--mysql-test/t/archive.test10
-rw-r--r--mysql-test/t/binlog_row_mix_innodb_myisam.test2
-rw-r--r--mysql-test/t/binlog_stm_mix_innodb_myisam.test2
-rw-r--r--mysql-test/t/client_xml.test2
-rw-r--r--mysql-test/t/compress.test1
-rw-r--r--mysql-test/t/crash_commit_before.test3
-rw-r--r--mysql-test/t/create.test95
-rw-r--r--mysql-test/t/ctype_cp932_binlog_stm.test2
-rw-r--r--mysql-test/t/ctype_uca.test10
-rw-r--r--mysql-test/t/ctype_ucs.test14
-rw-r--r--mysql-test/t/ctype_utf8.test43
-rw-r--r--mysql-test/t/date_formats.test2
-rw-r--r--mysql-test/t/delayed.test18
-rw-r--r--mysql-test/t/delete.test18
-rw-r--r--mysql-test/t/disabled.def14
-rw-r--r--mysql-test/t/distinct.test13
-rw-r--r--mysql-test/t/endspace.test9
-rw-r--r--mysql-test/t/errors.test12
-rw-r--r--mysql-test/t/events.test399
-rw-r--r--mysql-test/t/events_bugs.test198
-rw-r--r--mysql-test/t/events_logs_tests.test6
-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.test46
-rw-r--r--mysql-test/t/events_restart_phase2.test44
-rw-r--r--mysql-test/t/events_restart_phase3.test22
-rw-r--r--mysql-test/t/events_scheduling.test82
-rw-r--r--mysql-test/t/events_time_zone.test294
-rw-r--r--mysql-test/t/events_trans.test115
-rw-r--r--mysql-test/t/events_trans_notembedded.test61
-rw-r--r--mysql-test/t/federated_server.test227
-rw-r--r--mysql-test/t/flush2.test4
-rw-r--r--mysql-test/t/fulltext_left_join.test11
-rw-r--r--mysql-test/t/func_gconcat.test12
-rw-r--r--mysql-test/t/func_group.test11
-rw-r--r--mysql-test/t/func_in.test11
-rw-r--r--mysql-test/t/func_sapdb.test2
-rw-r--r--mysql-test/t/func_str.test4
-rw-r--r--mysql-test/t/gis-rtree.test562
-rw-r--r--mysql-test/t/gis.test91
-rw-r--r--mysql-test/t/grant.test241
-rw-r--r--mysql-test/t/grant_cache.test26
-rw-r--r--mysql-test/t/group_by.test77
-rw-r--r--mysql-test/t/heap.test9
-rw-r--r--mysql-test/t/heap_btree.test32
-rw-r--r--mysql-test/t/help.test71
-rw-r--r--mysql-test/t/information_schema.test36
-rw-r--r--mysql-test/t/information_schema_db.test55
-rw-r--r--mysql-test/t/init_connect.test5
-rw-r--r--mysql-test/t/innodb.test29
-rw-r--r--mysql-test/t/insert_select.test27
-rw-r--r--mysql-test/t/insert_update.test85
-rw-r--r--mysql-test/t/key.test48
-rw-r--r--mysql-test/t/loaddata.test20
-rw-r--r--mysql-test/t/lock.test44
-rw-r--r--mysql-test/t/log_state.test4
-rw-r--r--mysql-test/t/log_tables-big-master.opt1
-rw-r--r--mysql-test/t/log_tables-big.test35
-rw-r--r--mysql-test/t/merge.test17
-rw-r--r--mysql-test/t/myisam-system.test6
-rw-r--r--mysql-test/t/myisam.test144
-rw-r--r--mysql-test/t/mysqlbinlog-cp932.test3
-rw-r--r--mysql-test/t/mysqlbinlog.test8
-rw-r--r--mysql-test/t/mysqlbinlog2.test24
-rw-r--r--mysql-test/t/mysqldump.test68
-rw-r--r--mysql-test/t/mysqlslap.test24
-rw-r--r--mysql-test/t/ndb_autodiscover.test32
-rw-r--r--mysql-test/t/ndb_autodiscover3.test12
-rw-r--r--mysql-test/t/ndb_binlog_ddl_multi.test20
-rw-r--r--mysql-test/t/ndb_binlog_discover.test5
-rw-r--r--mysql-test/t/ndb_binlog_ignore_db.test2
-rw-r--r--mysql-test/t/ndb_binlog_log_bin.test50
-rw-r--r--mysql-test/t/ndb_binlog_multi.test8
-rw-r--r--mysql-test/t/ndb_blob.test5
-rw-r--r--mysql-test/t/ndb_cache_multi2.test31
-rw-r--r--mysql-test/t/ndb_dd_basic.test48
-rw-r--r--mysql-test/t/ndb_loaddatalocal.test8
-rw-r--r--mysql-test/t/ndb_partition_error2-master.opt1
-rw-r--r--mysql-test/t/ndb_partition_error2.test14
-rw-r--r--mysql-test/t/ndb_restore.test40
-rw-r--r--mysql-test/t/ndb_restore_print.test189
-rw-r--r--mysql-test/t/ndb_single_user.test117
-rw-r--r--mysql-test/t/ndb_trigger.test107
-rw-r--r--mysql-test/t/openssl_1.test45
-rw-r--r--mysql-test/t/order_by.test51
-rw-r--r--mysql-test/t/partition.test29
-rw-r--r--mysql-test/t/partition_grant.test24
-rw-r--r--mysql-test/t/ps.test59
-rw-r--r--mysql-test/t/query_cache.test20
-rw-r--r--mysql-test/t/query_cache_sql_prepare.test146
-rw-r--r--mysql-test/t/range.test143
-rw-r--r--mysql-test/t/row.test42
-rw-r--r--mysql-test/t/rpl_critical_errors.test66
-rw-r--r--mysql-test/t/rpl_ddl.test12
-rw-r--r--mysql-test/t/rpl_dual_pos_advance.test6
-rw-r--r--mysql-test/t/rpl_events.test24
-rw-r--r--mysql-test/t/rpl_flushlog_loop.test3
-rw-r--r--mysql-test/t/rpl_ignore_table.test110
-rw-r--r--mysql-test/t/rpl_incident-master.opt1
-rw-r--r--mysql-test/t/rpl_incident.test43
-rw-r--r--mysql-test/t/rpl_loaddata_s.test4
-rw-r--r--mysql-test/t/rpl_loaddatalocal.test4
-rw-r--r--mysql-test/t/rpl_log_pos.test10
-rw-r--r--mysql-test/t/rpl_misc_functions.test4
-rw-r--r--mysql-test/t/rpl_ndb_basic.test74
-rw-r--r--mysql-test/t/rpl_ndb_circular.test57
-rw-r--r--mysql-test/t/rpl_ndb_circular_simplex.test82
-rw-r--r--mysql-test/t/rpl_ndb_dd_basic.test2
-rw-r--r--mysql-test/t/rpl_ndb_ddl.test18
-rw-r--r--mysql-test/t/rpl_ndb_do_table.test14
-rw-r--r--mysql-test/t/rpl_ndb_stm_innodb-master.opt1
-rw-r--r--mysql-test/t/rpl_ndb_stm_innodb.test62
-rw-r--r--mysql-test/t/rpl_packet.test41
-rw-r--r--mysql-test/t/rpl_rbr_to_sbr.test4
-rw-r--r--mysql-test/t/rpl_row_NOW.test4
-rw-r--r--mysql-test/t/rpl_row_basic_11bugs-master.opt3
-rw-r--r--mysql-test/t/rpl_row_basic_11bugs-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_basic_11bugs.test69
-rw-r--r--mysql-test/t/rpl_row_create_table.test23
-rw-r--r--mysql-test/t/rpl_row_flsh_tbls.test2
-rw-r--r--mysql-test/t/rpl_row_mysqlbinlog.test6
-rw-r--r--mysql-test/t/rpl_row_sp001.test4
-rw-r--r--mysql-test/t/rpl_row_sp011.test4
-rw-r--r--mysql-test/t/rpl_sp.test2
-rw-r--r--mysql-test/t/rpl_ssl.test9
-rw-r--r--mysql-test/t/rpl_ssl1.test (renamed from mysql-test/t/rpl_openssl.test)36
-rw-r--r--mysql-test/t/rpl_stm_flsh_tbls.test2
-rw-r--r--mysql-test/t/rpl_switch_stm_row_mixed.test8
-rw-r--r--mysql-test/t/rpl_udf.test22
-rw-r--r--mysql-test/t/select.test60
-rw-r--r--mysql-test/t/show_check.test3
-rw-r--r--mysql-test/t/skip_grants.test14
-rw-r--r--mysql-test/t/sp-code.test18
-rw-r--r--mysql-test/t/sp-destruct.test32
-rw-r--r--mysql-test/t/sp-error.test68
-rw-r--r--mysql-test/t/sp-security.test77
-rw-r--r--mysql-test/t/sp.test309
-rw-r--r--mysql-test/t/sp_trans_log.test43
-rw-r--r--mysql-test/t/ssl_des-master.opt1
-rw-r--r--mysql-test/t/strict.test67
-rw-r--r--mysql-test/t/subselect.test130
-rw-r--r--mysql-test/t/subselect3.test39
-rw-r--r--mysql-test/t/temp_table.test15
-rw-r--r--mysql-test/t/timezone2.test28
-rw-r--r--mysql-test/t/trigger.test38
-rw-r--r--mysql-test/t/truncate.test32
-rw-r--r--mysql-test/t/type_date.test13
-rw-r--r--mysql-test/t/type_datetime.test28
-rw-r--r--mysql-test/t/type_newdecimal.test21
-rw-r--r--mysql-test/t/type_set.test17
-rw-r--r--mysql-test/t/type_year.test10
-rw-r--r--mysql-test/t/union.test9
-rw-r--r--mysql-test/t/user_var-binlog.test5
-rw-r--r--mysql-test/t/variables.test24
-rw-r--r--mysql-test/t/view.test9
-rw-r--r--mysql-test/t/view_grant.test168
-rwxr-xr-xmysql-test/t/wait_for_socket.sh2
-rw-r--r--mysql-test/t/windows.test21
-rw-r--r--mysql-test/t/xml.test7
507 files changed, 56542 insertions, 6061 deletions
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test
index 834edcff474..c59685a0e65 100644
--- a/mysql-test/extra/binlog_tests/binlog.test
+++ b/mysql-test/extra/binlog_tests/binlog.test
@@ -20,9 +20,7 @@ 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;
+source include/show_binlog_events.inc;
drop table t1,t2;
#
@@ -44,10 +42,10 @@ 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;
+show binlog events in 'master-bin.000001' from 106;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events in 'master-bin.000002' from 102;
+show binlog events in 'master-bin.000002' from 106;
# 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
@@ -80,9 +78,24 @@ DELETE FROM user WHERE host='localhost' AND user='@#@';
--enable_warnings
use test;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
drop table t1,t2,t3,tt1;
-- source extra/binlog_tests/binlog_insert_delayed.test
+
+#Bug #26079 max_binlog_size + innodb = not make new binlog and hang server
+# server should not hang, binlog must rotate in the end
+reset master;
+--disable_warnings
+drop table if exists t3;
+--enable_warnings
+create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
+show master status;
+let $it=4;
+while ($it)
+{
+insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+dec $it;
+}
+show master status /* must show new binlog index after rotating */;
+drop table t3;
diff --git a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
index 4da883b9e60..d073c8ef227 100644
--- a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
+++ b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
@@ -23,9 +23,7 @@ inc $count;
# 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;
+source include/show_binlog_events.inc;
insert delayed into t1 values (null),(null),(null),(null);
inc $count; inc $count; inc $count; inc $count;
diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test
index 05e59838168..80f998359ba 100644
--- a/mysql-test/extra/binlog_tests/blackhole.test
+++ b/mysql-test/extra/binlog_tests/blackhole.test
@@ -121,11 +121,7 @@ select * from t2;
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;
-
+source include/show_binlog_events.inc;
drop table t1,t2,t3;
#
@@ -157,10 +153,7 @@ 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;
+source include/show_binlog_events.inc;
drop table if exists t1;
# End of 5.0 tests
diff --git a/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test b/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test
index 5e93d6e126e..30585ece71c 100644
--- a/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test
+++ b/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test
@@ -26,9 +26,7 @@ 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;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 102;
+source include/show_binlog_events.inc;
SELECT HEX(f1) FROM t1;
DROP table t1;
# end test for bug#11338
diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
index fcf39e38163..e1a9dba7775 100644
--- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
+++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
@@ -9,8 +9,7 @@ create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events from 102;
+source include/show_binlog_events.inc;
# 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/extra/binlog_tests/drop_temp_table.test b/mysql-test/extra/binlog_tests/drop_temp_table.test
index 9c8647395bf..87f94eff987 100644
--- a/mysql-test/extra/binlog_tests/drop_temp_table.test
+++ b/mysql-test/extra/binlog_tests/drop_temp_table.test
@@ -23,10 +23,7 @@ connection con2;
# To be sure that logging has been done, we use a user lock.
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;
+source include/show_binlog_events.inc;
drop database `drop-temp+table-test`;
# End of 4.1 tests
diff --git a/mysql-test/extra/binlog_tests/insert_select-binlog.test b/mysql-test/extra/binlog_tests/insert_select-binlog.test
index 07da4a1907f..b09eebcb996 100644
--- a/mysql-test/extra/binlog_tests/insert_select-binlog.test
+++ b/mysql-test/extra/binlog_tests/insert_select-binlog.test
@@ -18,9 +18,7 @@ insert into t1 select * from t2;
# The above should produce an error, but still be in the binlog;
# verify the binlog :
let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events;
+source include/show_binlog_events.inc;
select * from t1;
drop table t1, t2;
@@ -33,9 +31,7 @@ reset master;
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;
+source include/show_binlog_events.inc;
drop table t1;
# End of 4.1 tests
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
index bb4194bc7a7..d6ccc403ce9 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -29,9 +29,7 @@ insert into t1 values(1);
insert into t2 select * from t1;
commit;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -43,9 +41,7 @@ insert into t2 select * from t1;
# should say some changes to non-transact1onal tables couldn't be rolled back
rollback;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -59,9 +55,7 @@ insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -77,9 +71,7 @@ insert into t1 values(7);
commit;
select a from t1 order by a; # check that savepoints work :)
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
# and when ROLLBACK is not explicit?
delete from t1;
@@ -99,9 +91,7 @@ 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 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
# and when not in a transact1on?
delete from t1;
@@ -111,9 +101,7 @@ reset master;
insert into t1 values(9);
insert into t2 select * from t1;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
# Check that when the query updat1ng the MyISAM table is the first in the
# transaction, we log it immediately.
@@ -124,16 +112,11 @@ reset master;
insert into t1 values(10); # first make t1 non-empty
begin;
insert into t2 select * from t1;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
insert into t1 values(11);
commit;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
-
+source include/show_binlog_events.inc;
# Check that things work like before this BEGIN/ROLLBACK code was added,
# when t2 is INNODB
@@ -149,9 +132,7 @@ insert into t1 values(12);
insert into t2 select * from t1;
commit;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -162,9 +143,7 @@ insert into t1 values(13);
insert into t2 select * from t1;
rollback;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -178,9 +157,7 @@ insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -196,9 +173,7 @@ insert into t1 values(18);
commit;
select a from t1 order by a; # check that savepoints work :)
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
# Test for BUG#5714, where a MyISAM update in the transaction used to
# release row-level locks in InnoDB
@@ -257,9 +232,7 @@ insert into t2 values (3);
disconnect con2;
connection con3;
select get_lock("lock1",60);
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events from 102;
+source include/show_binlog_events.inc;
do release_lock("lock1");
drop table t0,t2;
@@ -324,9 +297,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select *
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;
+source include/show_binlog_events.inc;
# 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
diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test
index 15794e5e035..e40532f005f 100644
--- a/mysql-test/extra/rpl_tests/rpl_ddl.test
+++ b/mysql-test/extra/rpl_tests/rpl_ddl.test
@@ -1,31 +1,128 @@
-######################## rpl_ddl.test ########################
-# #
-# DDL statements (sometimes with implicit COMMIT) executed #
-# by the master and it's propagation into the slave #
-# #
-##############################################################
-
+################# extra/rpl_tests/rpl_ddl.test ########################
+# #
+# DDL statements (sometimes with implicit COMMIT) and other stuff #
+# executed on the master and it's propagation into the slave. #
+# #
+# The variables #
+# $engine_type -- storage engine to be tested/used for the #
+# permanent tables within the master #
+# $temp_engine_type -- storage engine which supports TEMPORARY #
+# tables <> $engine_type #
+# $temp_engine_type must point to an all #
+# time available storage engine #
+# 2007-02 MySQL 5.1 MyISAM and MEMORY only #
+# $show_binlog -- print binlog entries #
+# 0 - no (default) + fits to the file with #
+# results #
+# 1 - yes (important for debugging) #
+# This variable is used within #
+# include/rpl_stmt_seq.inc. #
+# $manipulate -- Manipulation of the binary logs #
+# 0 - do nothing #
+# 1 - so that the output of SHOW BINLOG #
+# EVENTS IN <current log> contains only #
+# commands of the current test sequence #
+# This is especially useful, if the #
+# $show_binlog is set to 1 and many #
+# subtest are executed. #
+# This variable is used within #
+# include/rpl_stmt_seq.inc. #
+# have to be set before sourcing this script. #
+# #
+# General assumption about the ideal replication behaviour: #
+# Whatever on the master is executed the content of the slave must #
+# be in sync with it. #
+# #
+# Tests of special interest: #
+# a) Which DDL commands cause an implicit COMMIT ? #
+# This is also of interest outside of replication. #
+# b) Transactions modifying table content ending with #
+# - explicit COMMIT or ROLLBACK #
+# - implicit COMMIT because the connection to the master #
+# executed a corresponding DDL statement or runs in #
+# AUTOCOMMIT mode #
+# - something similar to "implicit COMMIT" if the storage #
+# engine (master) is not transactional #
+# c) Command which change no data like SELECT or SHOW #
+# They do not change anything within the master but #
+# this must be also valid for the slave. #
+# #
+#######################################################################
+
+# Last update:
+# 2007-02-12 ML: - slave needs AUTOCOMMIT = 1, because we want to check only
+# the propagation of actions of the master connection.
+# - replace comments via SQL by "--echo ..."
+# - remove some bugs within the testscripts
+# - remove the use of include/rpl_stmt_seq2.inc
+#
+#
+# NOTES:
+# 2006-11-15 Lars: Matthias (ML) is the "owner" of this test case.
+# So, please get him to review it whenever you want to
+# do changes to it.
+#
+# PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
#
-# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
+# Typical test architecture (--> include/rpl_stmt_seq.inc)
+# --------------------------------------------------------
+# 1. Master (no AUTOCOMMIT!): INSERT INTO mysqltest1.t1 without commit
+# 2. Master and slave: Check the content of mysqltest1.t1
+# 3. Master (no AUTOCOMMIT!): EXECUTE the statement to be tested
+# 4. Master and slave: Check the content of mysqltest1.t1
+# 5. Master (no AUTOCOMMIT!): ROLLBACK
+# 6. Master and slave: Check the content of mysqltest1.t1
+# If the previous into mysqltest1.t1 inserted row is visible,
+# than the statement to be tested caused an explicit COMMIT
+# (statement = COMMIT) or an implicit COMMIT (example CREATE TABLE).
+# If the previous into mysqltest1.t1 inserted row is not visible,
+# than the statement to be tested caused either an explicit ROLLBACK
+# (statement = ROLLBACK), an implicit ROLLBACK (deadlock etc. but
+# not tested here) or it does not cause any transaction end.
+# 7. Flush the logs
+#
+# Some rules:
+# -----------
+# 1. Any use of mysqltest1.t1 within the statement to be tested must be
+# avoided if possible. The only known exception is around LOCK TABLE.
+#
+# 2. The test logics needs for
+# master connection: AUTOCOMMIT = 0
+# slave connection: AUTOCOMMIT = 1
+# The master connection is the actor and the slave connection is
+# only an observer. I.e. the slave connection must not influence
+# the activities of master connection.
#
-# 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.
+# 3. !All! objects to be dropped, renamed, altered ... must be created
+# before the tests start.
+# --> less switching of AUTOCOMMIT mode on master side.
#
-# 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.
+# 4. Never use a test object, which was direct or indirect affected by a
+# preceeding test sequence again.
+# If one preceeding test sequence hits a (sometimes not 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.. This means during analysis the first look
+# points into a totally wrong area.
+# Except table mysqltest1.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..
+# 5. This file is used in several tests (t/rpl_ddl_<whatever>.test).
+# Please be aware that every change of the current file affects
+# the results of these tests.
#
-# 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 "";
+# ML: Some maybe banal hints:
+# 1. The fact that we have here a master - slave replication does
+# not cause that many general MySQL properties do not apply.
+# Example:
+# The connection to the slave is just a simple session and not a however
+# magic working "copy" of the master session or something similar.
+# - TEMPORARY TABLES and @variables are session specific
+# - the slave session cannot see these things of the master.
+# 2. The slave connection must not call sync_slave_with_master.
+# 3. SHOW STATUS SLAVE must be run within the slave connection.
+# 4. Testcase analysis becomes much more comfortable if
+# $show_binlog within include/rpl_stmt_seq.inc is set to 1.
#
###############################################################
@@ -33,8 +130,10 @@
###############################################################
# The sync_slave_with_master is needed to make the xids deterministic.
sync_slave_with_master;
-connection master;
+--echo
+--echo -------- switch to master -------
+connection master;
SET AUTOCOMMIT = 1;
#
# 1. DROP all objects, which probably already exist, but must be created here
@@ -47,7 +146,7 @@ DROP DATABASE IF EXISTS mysqltest3;
#
# 2. CREATE all objects needed
# working database is mysqltest1
-# working (transactional!) is mysqltest1.t1
+# working table (transactional!) is mysqltest1.t1
#
CREATE DATABASE mysqltest1;
CREATE DATABASE mysqltest2;
@@ -73,25 +172,23 @@ 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);
+eval CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=$temp_engine_type;
#
# 3. master sessions: never do AUTOCOMMIT
-# slave sessions: never do AUTOCOMMIT
+# slave sessions: do AUTOCOMMIT
#
SET AUTOCOMMIT = 0;
use mysqltest1;
sync_slave_with_master;
+--echo
+--echo -------- switch to slave --------
connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SET AUTOCOMMIT = 0;
+SET AUTOCOMMIT = 1;
use mysqltest1;
+--echo
+--echo -------- switch to master -------
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
@@ -100,6 +197,21 @@ SELECT '-------- switch to master -------' as "";
--disable_abort_on_error
###############################################################
+# Banal case: commands which should never commit
+# Just for checking if the test sequence is usable
+###############################################################
+
+let $my_stmt= SELECT 1;
+let $my_master_commit= false;
+let $my_slave_commit= false;
+--source include/rpl_stmt_seq.inc
+
+let $my_stmt= SELECT COUNT(*) FROM t1;
+let $my_master_commit= false;
+let $my_slave_commit= false;
+--source include/rpl_stmt_seq.inc
+
+###############################################################
# Banal case: (explicit) COMMIT and ROLLBACK
# Just for checking if the test sequence is usable
###############################################################
@@ -143,84 +255,64 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't2';
+--echo
+--echo -------- switch to slave --------
connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
SHOW TABLES LIKE 't2';
+--echo
+--echo -------- switch to master -------
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;
+let $my_slave_commit= false;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't23';
+--echo
+--echo -------- switch to slave --------
connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
SHOW TABLES LIKE 't23';
+--echo
+--echo -------- switch to master -------
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';
+--echo
+--echo -------- switch to slave --------
connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
SHOW TABLES LIKE 't20';
+--echo
+--echo -------- switch to master -------
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;
+--echo
+--echo -------- switch to slave --------
connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
describe mysqltest1.t4;
+--echo
+--echo -------- switch to master -------
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_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= $engine_type;
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).
+--source include/rpl_stmt_seq.inc
+
let $engine='';
let $eng_type='';
-let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
+let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=$temp_engine_type;
let $my_master_commit= false;
-let $my_slave_commit= true;
+let $my_slave_commit= false;
--source include/rpl_stmt_seq.inc
let $my_stmt= TRUNCATE TABLE mysqltest1.t7;
@@ -228,9 +320,12 @@ 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;
+--echo
+--echo -------- switch to slave --------
+connection slave;
SELECT * FROM mysqltest1.t7;
+--echo
--echo -------- switch to master -------
connection master;
@@ -238,8 +333,13 @@ connection master;
# Cases with LOCK/UNLOCK
###############################################################
-# MySQL insists in locking mysqltest1.t1, because rpl_stmt_seq performs an
-# INSERT into this table.
+# Attention:
+# We have to LOCK mysqltest1.t1 here, though it violates the testing
+# philosophy.
+# Mysql response in case without previous LOCK TABLES mysqltest1.t1
+# is:
+# SELECT MAX(...) FROM mysqltest1.t1 is
+# ERROR HY000: Table 't1' was not locked with LOCK TABLES
let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
let $my_master_commit= true;
let $my_slave_commit= true;
@@ -253,8 +353,9 @@ 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.
+# Attention:
+# This subtest generates 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;
@@ -277,30 +378,26 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW INDEX FROM mysqltest1.t6;
+--echo
+--echo -------- switch to slave --------
connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
SHOW INDEX FROM mysqltest1.t6;
+--echo
+--echo -------- switch to master -------
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;
+--echo
+--echo -------- switch to slave --------
connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
SHOW INDEX FROM mysqltest1.t5;
+--echo
+--echo -------- switch to master -------
connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
###############################################################
# Cases with DATABASE
@@ -311,35 +408,31 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW DATABASES LIKE "mysqltest2";
+--echo
+--echo -------- switch to slave --------
connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
SHOW DATABASES LIKE "mysqltest2";
+--echo
+--echo -------- switch to master -------
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";
+--echo
+--echo -------- switch to slave --------
connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
SHOW DATABASES LIKE "mysqltest3";
+--echo
+--echo -------- switch to master -------
connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
# End of 4.1 tests
###############################################################
-# Cases with stored procedures
+# Cases with STORED PROCEDUREs
###############################################################
let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
let $my_master_commit= true;
@@ -348,12 +441,13 @@ let $my_slave_commit= true;
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
+--echo
+--echo -------- switch to slave --------
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
+--echo
+--echo -------- switch to master -------
connection master;
--horizontal_results
@@ -364,12 +458,13 @@ let $my_slave_commit= true;
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
+--echo
+--echo -------- switch to slave --------
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
+--echo
+--echo -------- switch to master -------
connection master;
--horizontal_results
@@ -379,11 +474,12 @@ 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
+--echo
+--echo -------- switch to slave --------
connection slave;
SHOW PROCEDURE STATUS LIKE 'p1';
+--echo
+--echo -------- switch to master -------
connection master;
--horizontal_results
@@ -395,11 +491,12 @@ 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
+--echo
+--echo -------- switch to slave --------
connection slave;
SHOW CREATE VIEW v1;
+--echo
+--echo -------- switch to master -------
connection master;
let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
@@ -407,11 +504,12 @@ 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
+--echo
+--echo -------- switch to slave --------
connection slave;
SHOW CREATE VIEW v1;
+--echo
+--echo -------- switch to master -------
connection master;
let $my_stmt= DROP VIEW IF EXISTS v1;
@@ -420,12 +518,13 @@ 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
+--echo
+--echo -------- switch to slave --------
connection slave;
--error 1146
SHOW CREATE VIEW v1;
+--echo
+--echo -------- switch to master -------
connection master;
###############################################################
@@ -436,11 +535,12 @@ 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
+--echo
+--echo -------- switch to slave --------
connection slave;
SHOW TRIGGERS;
+--echo
+--echo -------- switch to master -------
connection master;
let $my_stmt= DROP TRIGGER trg1;
@@ -448,11 +548,12 @@ 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
+--echo
+--echo -------- switch to slave --------
connection slave;
SHOW TRIGGERS;
+--echo
+--echo -------- switch to master -------
connection master;
###############################################################
@@ -463,11 +564,12 @@ 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
+--echo
+--echo -------- switch to slave --------
connection slave;
SELECT user FROM mysql.user WHERE user = 'user1';
+--echo
+--echo -------- switch to master -------
connection master;
let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
@@ -475,11 +577,12 @@ 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
+--echo
+--echo -------- switch to slave --------
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
+--echo
+--echo -------- switch to master -------
connection master;
let $my_stmt= DROP USER rename1@localhost;
@@ -487,21 +590,21 @@ 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
+--echo
+--echo -------- switch to slave --------
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;
+use test;
+--echo
+--echo -------- switch to master -------
+connection master;
+DROP DATABASE mysqltest1;
+# mysqltest2 was alreday DROPPED some tests before.
+DROP DATABASE mysqltest3;
--enable_warnings
-- source include/master-slave-end.inc
-
diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test
index 236a5f801b0..f6e02546a0b 100644
--- a/mysql-test/extra/rpl_tests/rpl_deadlock.test
+++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test
@@ -82,7 +82,7 @@ show slave status;
stop slave;
delete from t3;
-change master to master_log_pos=544; # the BEGIN log event
+change master to master_log_pos=548; # the BEGIN log event
begin;
select * from t2 for update; # hold lock
start slave;
@@ -107,7 +107,7 @@ set global max_relay_log_size=0;
# This is really copy-paste of 2) of above
stop slave;
delete from t3;
-change master to master_log_pos=544;
+change master to master_log_pos=548;
begin;
select * from t2 for update;
start slave;
diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index 9f6f4bf7e57..932fcdf670b 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -42,13 +42,13 @@ select count(*) from t1;
show binlog events;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 102 limit 1;
+show binlog events from 106 limit 1;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 102 limit 2;
+show binlog events from 106 limit 2;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 102 limit 2,1;
+show binlog events from 106 limit 2,1;
flush logs;
# We need an extra update before doing save_master_pos.
@@ -88,10 +88,7 @@ connection master;
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;
+source include/show_binlog_events.inc;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
@@ -142,10 +139,7 @@ insert into t1 values (NULL, 1);
reset master;
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events;
+source include/show_binlog_events.inc;
select * from t1;
drop table t1;
diff --git a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
index 5b995374ba0..d05fefe916b 100644
--- a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
@@ -6,6 +6,9 @@
# Requires statement logging
-- source include/master-slave.inc
+# We have to sync with master, to ensure slave had time to start properly
+# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
+sync_slave_with_master;
connection slave;
stop slave;
connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_multi_query.test b/mysql-test/extra/rpl_tests/rpl_multi_query.test
index 30a83886a86..2438556450d 100644
--- a/mysql-test/extra/rpl_tests/rpl_multi_query.test
+++ b/mysql-test/extra/rpl_tests/rpl_multi_query.test
@@ -23,8 +23,6 @@ delimiter ;/
sync_slave_with_master;
select * from mysqltest.t1;
connection master;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events from 102;
+source include/show_binlog_events.inc;
drop database mysqltest;
sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_ddl.test b/mysql-test/extra/rpl_tests/rpl_ndb_ddl.test
deleted file mode 100644
index 26c368589ba..00000000000
--- a/mysql-test/extra/rpl_tests/rpl_ndb_ddl.test
+++ /dev/null
@@ -1,507 +0,0 @@
-######################## 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= false;
---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= false;
---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/extra/rpl_tests/rpl_relayrotate.test b/mysql-test/extra/rpl_tests/rpl_relayrotate.test
index dc91f9e7fff..0d2f25e2b4a 100644
--- a/mysql-test/extra/rpl_tests/rpl_relayrotate.test
+++ b/mysql-test/extra/rpl_tests/rpl_relayrotate.test
@@ -10,6 +10,10 @@
-- source include/master-slave.inc
+# We have to sync with master, to ensure slave had time to start properly
+# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
+connection master;
+sync_slave_with_master;
connection slave;
stop slave;
connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_charset.test b/mysql-test/extra/rpl_tests/rpl_row_charset.test
index 336a038db10..4ce5245a79a 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_charset.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_charset.test
@@ -113,9 +113,7 @@ 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;
+source include/show_binlog_events.inc;
sync_slave_with_master;
# Check that we can change global.collation_server (since 5.0.3)
diff --git a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
index 0e235f8838f..c4e6dbc84c2 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
@@ -15,9 +15,7 @@ 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;
+source include/show_binlog_events.inc;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY a;
connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp002.test b/mysql-test/extra/rpl_tests/rpl_row_sp002.test
index 9d056626cf2..47afcce875b 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_sp002.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp002.test
@@ -222,7 +222,7 @@ sync_with_master;
select * from test.t3;
connection master;
-#show binlog events from 1626;
+#show binlog events from 1627;
# First lets cleanup
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
index 0934e2d6f98..df318ee0c0b 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
@@ -65,7 +65,7 @@ sync_slave_with_master;
connection slave;
SELECT * FROM test.t1;
connection master;
-#show binlog events from 719;
+#show binlog events from 720;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_charset.test b/mysql-test/extra/rpl_tests/rpl_stm_charset.test
index 5657b06e88f..629ccdf69f7 100644
--- a/mysql-test/extra/rpl_tests/rpl_stm_charset.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_charset.test
@@ -109,9 +109,7 @@ 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;
+source include/show_binlog_events.inc;
sync_slave_with_master;
# Check that we can change global.collation_server (since 5.0.3)
diff --git a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
index 7f1506c4010..64a8de7c6a0 100644
--- a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
+++ b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
@@ -37,6 +37,4 @@ SELECT * FROM t1;
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;
+source include/show_binlog_events.inc;
diff --git a/mysql-test/include/federated.inc b/mysql-test/include/federated.inc
index c8e8ededa11..dde24cd8198 100644
--- a/mysql-test/include/federated.inc
+++ b/mysql-test/include/federated.inc
@@ -5,6 +5,11 @@ source ./include/master-slave.inc;
# remote table creation
+# We have to sync with master, to ensure slave had time to start properly
+# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
+connection master;
+sync_slave_with_master;
+
connection slave;
#--replicate-ignore-db=federated
stop slave;
diff --git a/mysql-test/include/federated_cleanup.inc b/mysql-test/include/federated_cleanup.inc
index 17a6e1e5100..06fd7f6737a 100644
--- a/mysql-test/include/federated_cleanup.inc
+++ b/mysql-test/include/federated_cleanup.inc
@@ -2,10 +2,8 @@ connection master;
--disable_warnings
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
---enable_warnings
connection slave;
---disable_warnings
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
--enable_warnings
diff --git a/mysql-test/include/gis_generic.inc b/mysql-test/include/gis_generic.inc
index e3b716953c3..e4fee4448c1 100644
--- a/mysql-test/include/gis_generic.inc
+++ b/mysql-test/include/gis_generic.inc
@@ -178,4 +178,73 @@ insert into t1 (fl) values (pointfromtext('point(1,1)'));
drop table t1;
-# End of 5.0 tests
+--echo End of 4.1 tests
+
+
+#
+# Bug#24563: MBROverlaps does not seem to function propertly
+# Bug#54888: MBROverlaps missing in 5.1?
+#
+
+# Test all MBR* functions and their non-MBR-prefixed aliases,
+# using shifted squares to verify the spatial relations.
+
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+
+# Overlaps needs a few more tests, with point and line dimensions
+
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/include/have_query_cache.inc b/mysql-test/include/have_query_cache.inc
index 39549157849..e5e6052c9a7 100644
--- a/mysql-test/include/have_query_cache.inc
+++ b/mysql-test/include/have_query_cache.inc
@@ -1,7 +1,4 @@
-- require r/have_query_cache.require
-# As PS are not cached we disable them to ensure the we get the right number
-# of query cache hits
--- disable_ps_protocol
disable_query_log;
show variables like "have_query_cache";
enable_query_log;
diff --git a/mysql-test/include/ndb_backup_print.inc b/mysql-test/include/ndb_backup_print.inc
new file mode 100644
index 00000000000..57fb279491c
--- /dev/null
+++ b/mysql-test/include/ndb_backup_print.inc
@@ -0,0 +1,6 @@
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter > $MYSQLTEST_VARDIR/tmp/tmp.dat
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter >> $MYSQLTEST_VARDIR/tmp/tmp.dat
+--exec sort $MYSQLTEST_VARDIR/tmp/tmp.dat
+--exec rm -f $MYSQLTEST_VARDIR/tmp/tmp.dat
+--let ndb_restore_opts=
+--let ndb_restore_filter=
diff --git a/mysql-test/include/not_embedded.inc b/mysql-test/include/not_embedded.inc
index fcc1756caab..360f268ad4f 100644
--- a/mysql-test/include/not_embedded.inc
+++ b/mysql-test/include/not_embedded.inc
@@ -1,5 +1,5 @@
-- require r/not_embedded.require
disable_query_log;
-select version() like N'%embedded%' as 'have_embedded';
+select version() like '%embedded%' as 'have_embedded';
enable_query_log;
diff --git a/mysql-test/include/rpl_events.inc b/mysql-test/include/rpl_events.inc
new file mode 100644
index 00000000000..04885f31997
--- /dev/null
+++ b/mysql-test/include/rpl_events.inc
@@ -0,0 +1,119 @@
+##################################################################
+# Author: Giuseppe, Chuck Bell #
+# Date: 17-January-2007 #
+# Purpose: To test that event effects are replicated #
+# in both row based and statement based format #
+##################################################################
+
+--disable_warnings
+DROP EVENT IF EXISTS test.justonce;
+drop table if exists t1,t2;
+--enable_warnings
+
+# first, we need a table to record something from an event
+
+eval CREATE TABLE `t1` (
+ `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `c` VARCHAR(50) NOT NULL,
+ `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=$engine_type DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 (c) VALUES ('manually');
+
+# then, we create the event
+CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1
+(c) VALUES ('from justonce');
+
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+
+# wait 3 seconds, so the event can trigger
+--real_sleep 3
+
+# check that table t1 contains something
+--echo "in the master"
+--enable_info
+--replace_column 3 TIMESTAMP
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+--disable_info
+
+sync_slave_with_master;
+
+--echo "in the slave"
+--enable_info
+--replace_column 3 TIMESTAMP
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+--disable_info
+
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+
+# Create an event on the slave and check to see what the originator is.
+--disable_warnings
+DROP EVENT IF EXISTS test.slave_once;
+--enable_warnings
+
+CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
+INSERT INTO t1(c) VALUES ('from slave_once');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
+
+--disable_warnings
+DROP EVENT IF EXISTS test.slave_once;
+--enable_warnings
+
+connection master;
+
+# BUG#20384 - disable events on slave
+--disable_warnings
+DROP EVENT IF EXISTS test.justonce;
+--enable_warnings
+
+CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
+INSERT INTO t1(c) VALUES ('from er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+
+sync_slave_with_master;
+
+--echo "in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+
+connection master;
+--echo "in the master"
+ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+
+sync_slave_with_master;
+
+--echo "in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+
+connection master;
+--echo "in the master"
+DROP EVENT test.er;
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+
+--disable_info
+
+sync_slave_with_master;
+
+--echo "in the slave"
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+
+# test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status
+# on CREATE EVENT
+
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+
+DROP EVENT test.slave_terminate;
+
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+
+DROP EVENT test.slave_terminate;
+
+--echo "in the master"
+connection master;
+DROP TABLE t1;
+
diff --git a/mysql-test/include/rpl_stmt_seq.inc b/mysql-test/include/rpl_stmt_seq.inc
index 3c91505d0d6..6c944dc4729 100644
--- a/mysql-test/include/rpl_stmt_seq.inc
+++ b/mysql-test/include/rpl_stmt_seq.inc
@@ -1,30 +1,51 @@
-# include/rpl_stmt_seq.inc
-#
-# Please be very careful when editing this routine, because the handling of
-# the $variables is extreme sensitive.
-#
+################### include/rpl_stmt_seq.inc ###########################
+# #
+# Check if a given SQL statement (->$my_stmt) / AUTOCOMMIT mode / #
+# storage engine somehow involved causes COMMIT or ROLLBACK. #
+# #
+# #
+# The typical test sequence #
+# ------------------------- #
+# 1. master connection: INSERT without commit #
+# check table content of master and slave #
+# 2. master connection: EXECUTE the statement #
+# check table content of master and slave #
+# 3. master connection: ROLLBACK #
+# check table content of master and slave #
+# 4. flush the logs #
+# #
+# The variables #
+# $show_binlog -- print binlog entries #
+# 0 - default + fits to the file with #
+# results #
+# 1 - useful for debugging #
+# This variable is used within #
+# include/rpl_stmt_seq.inc. #
+# $manipulate -- Manipulation of the binary logs #
+# 0 - do nothing #
+# 1 - so that the output of SHOW BINLOG #
+# EVENTS IN <current log> contains only #
+# commands of the current test sequence #
+# This is especially useful, if the #
+# $show_binlog is set to 1 and many #
+# subtest are executed. #
+# This variable is used within #
+# include/rpl_stmt_seq.inc. #
+# have to be set before sourcing this script. #
+# #
+# 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
+# Last update:
+# 2007-02-12 ML Replace comments via SQL by "--echo ..."
+#
let $VERSION=`select version()`;
---disable_query_log
-# SELECT '######## new test sequence ########' as "";
-eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
---enable_query_log
+--echo
+--echo ######## $my_stmt ########
###############################################################
@@ -49,11 +70,10 @@ let $_log_num_s= `select @aux`;
###############################################################
# INSERT
###############################################################
+--echo
+--echo -------- switch to master -------
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.
+# Maybe it would be smarter to use a table with an autoincrement column.
let $MAX= `SELECT MAX(f1) FROM t1` ;
eval INSERT INTO t1 SET f1= $MAX + 1;
# results before DDL(to be tested)
@@ -66,10 +86,9 @@ eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
+--echo
+--echo -------- switch to slave --------
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)
@@ -82,10 +101,9 @@ eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
###############################################################
# command to be tested
###############################################################
+--echo
+--echo -------- switch to master -------
connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
eval $my_stmt;
# Devaluate $my_stmt, to detect script bugs
let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT;
@@ -99,10 +117,9 @@ eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
+--echo
+--echo -------- switch to slave --------
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)
@@ -115,10 +132,9 @@ eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
###############################################################
# ROLLBACK
###############################################################
+--echo
+--echo -------- switch to master -------
connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
ROLLBACK;
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
@@ -140,10 +156,9 @@ eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
+--echo
+--echo -------- switch to slave --------
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
@@ -172,19 +187,17 @@ if ($manipulate)
# - flush the master and the slave log
# ---> both start to write into new logs with incremented number
# - increment $_log_num_n
+--echo
+--echo -------- switch to master -------
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;
+--echo
+--echo -------- switch to slave --------
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.
@@ -195,7 +208,6 @@ flush logs;
inc $_log_num_n;
}
+--echo
+--echo -------- switch to master -------
connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
diff --git a/mysql-test/include/rpl_stmt_seq2.inc b/mysql-test/include/rpl_stmt_seq2.inc
deleted file mode 100644
index 7671a6a857c..00000000000
--- a/mysql-test/include/rpl_stmt_seq2.inc
+++ /dev/null
@@ -1,201 +0,0 @@
-# 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/rpl_udf.inc b/mysql-test/include/rpl_udf.inc
new file mode 100644
index 00000000000..d9e19cda484
--- /dev/null
+++ b/mysql-test/include/rpl_udf.inc
@@ -0,0 +1,189 @@
+#####################################################################
+# Author: Chuck Bell #
+# Date: 2006-12-21 #
+# Purpose: To test that UDFs are replicated in both row based and #
+# statement based format. This tests work completed in WL#3629. #
+# #
+# This test is designed to exercise two of the three types of UDFs: #
+# 1) UDFs via loadable libraries, and 2) UDFs with a SQL body. #
+#####################################################################
+
+--source include/have_udf.inc
+
+#
+# To run this tests the "sql/udf_example.c" need to be compiled into
+# udf_example.so and LD_LIBRARY_PATH should be setup to point out where
+# the library are.
+#
+
+connection master;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Test 1) Test UDFs via loadable libraries
+#
+--echo "*** Test 1) Test UDFs via loadable libraries ***
+--echo "Running on the master"
+--enable_info
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_LIB";
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+--error ER_CANT_FIND_DL_ENTRY
+eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
+--replace_column 3 UDF_LIB
+SELECT * FROM mysql.func;
+--disable_info
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# Check to see that UDF CREATE statements were replicated
+--echo "Running on the slave"
+--enable_info
+--replace_column 3 UDF_LIB
+SELECT * FROM mysql.func;
+--disable_info
+
+connection master;
+
+# Use the UDFs to do something
+--echo "Running on the master"
+--enable_info
+eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
+INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
+INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
+INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
+INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
+SELECT * FROM t1 ORDER BY sum;
+--disable_info
+
+sync_slave_with_master;
+
+# Check to see if data was replicated
+--echo "Running on the slave"
+--enable_info
+SELECT * FROM t1 ORDER BY sum;
+
+# Check to see that the functions are available for execution on the slave
+SELECT myfunc_int(25);
+SELECT myfunc_double(75.00);
+--disable_info
+
+connection master;
+
+# Drop the functions
+--echo "Running on the master"
+--enable_info
+DROP FUNCTION myfunc_double;
+DROP FUNCTION myfunc_int;
+SELECT * FROM mysql.func;
+--disable_info
+
+sync_slave_with_master;
+
+# Check to see if the UDFs were dropped on the slave
+--echo "Running on the slave"
+--enable_info
+SELECT * FROM mysql.func;
+--disable_info
+
+connection master;
+
+# Cleanup
+--echo "Running on the master"
+--enable_info
+DROP TABLE t1;
+--disable_info
+
+#
+# Test 2) Test UDFs with SQL body
+#
+--echo "*** Test 2) Test UDFs with SQL body ***
+--echo "Running on the master"
+--enable_info
+CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
+CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+--disable_info
+
+sync_slave_with_master;
+
+# Check to see that UDF CREATE statements were replicated
+--echo "Running on the slave"
+--enable_info
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+--disable_info
+
+connection master;
+
+# Use the UDFs to do something
+--echo "Running on the master"
+--enable_info
+eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
+INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
+INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
+INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
+INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
+SELECT * FROM t1 ORDER BY sum;
+--disable_info
+
+sync_slave_with_master;
+
+# Check to see if data was replicated
+--echo "Running on the slave"
+--enable_info
+SELECT * FROM t1 ORDER BY sum;
+--disable_info
+
+connection master;
+
+# Modify the UDFs to add a comment
+--echo "Running on the master"
+--enable_info
+ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
+ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+--disable_info
+
+sync_slave_with_master;
+
+# Check to see if data was replicated
+--echo "Running on the slave"
+--enable_info
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+
+# Check to see that the functions are available for execution on the slave
+SELECT myfuncsql_int(25);
+SELECT myfuncsql_double(75.00);
+--disable_info
+
+connection master;
+
+# Drop the functions
+--echo "Running on the master"
+--enable_info
+DROP FUNCTION myfuncsql_double;
+DROP FUNCTION myfuncsql_int;
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+--disable_info
+
+sync_slave_with_master;
+
+# Check to see if the UDFs were dropped on the slave
+--echo "Running on the slave"
+--enable_info
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+--disable_info
+
+connection master;
+
+# Cleanup
+--echo "Running on the master"
+--enable_info
+DROP TABLE t1;
+--disable_info
diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc
index ae848d10687..7377b4a0fed 100644
--- a/mysql-test/include/show_binlog_events.inc
+++ b/mysql-test/include/show_binlog_events.inc
@@ -1,5 +1,5 @@
---let $binlog_start=102
+--let $binlog_start=106
--replace_result $binlog_start <binlog_start>
--replace_column 2 # 4 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
--eval show binlog events from $binlog_start
diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc
new file mode 100644
index 00000000000..234b7e06fcf
--- /dev/null
+++ b/mysql-test/include/show_binlog_events2.inc
@@ -0,0 +1,9 @@
+#
+# Differs slightly from show_binlog events in showing server_id
+# which is important for some tests
+#
+--let $binlog_start=106
+--replace_result $binlog_start <binlog_start>
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+--eval show binlog events from $binlog_start
diff --git a/mysql-test/include/wait_condition.inc b/mysql-test/include/wait_condition.inc
index cd80b58d44e..2e6bd276aac 100644
--- a/mysql-test/include/wait_condition.inc
+++ b/mysql-test/include/wait_condition.inc
@@ -11,13 +11,28 @@
# SELECT c = 3 FROM t;
# --source include/wait_condition.inc
#
+# OR
+#
+# let $wait_timeout= 60; # Override default 30 seconds with 60.
+# let $wait_condition=
+# SELECT c = 3 FROM t;
+# --source include/wait_condition.inc
+#
# EXAMPLE
-# events_bugs.test
+# events_bugs.test, events_time_zone.test
#
--disable_query_log
let $wait_counter= 300;
+if ($wait_timeout)
+{
+ let $wait_counter= `SELECT $wait_timeout * 10`;
+}
+# Reset $wait_timeout so that its value won't be used on subsequent
+# calls, and default will be used instead.
+let $wait_timeout= 0;
+
while ($wait_counter)
{
let $success= `$wait_condition`;
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index 74d95fdc521..e4df8f619cc 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -22,7 +22,7 @@ if [ x$1 = x"--bin" ]; then
BINARY_DIST=1
bindir=../bin
- scriptdir=../bin
+ scriptdir=bin
libexecdir=../libexec
# Check if it's a binary distribution or a 'make install'
@@ -33,7 +33,7 @@ if [ x$1 = x"--bin" ]; then
then
execdir=../../sbin
bindir=../../bin
- scriptdir=../../bin
+ scriptdir=../bin
libexecdir=../../libexec
else
execdir=../bin
@@ -43,7 +43,7 @@ else
execdir=../sql
bindir=../client
fix_bin=.
- scriptdir=../scripts
+ scriptdir=scripts
libexecdir=../libexec
fi
@@ -99,15 +99,14 @@ if [ x$BINARY_DIST = x1 ] ; then
basedir=..
else
basedir=.
-EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/"
+EXTRA_ARG="--windows"
fi
-mysqld_boot="${MYSQLD_BOOTSTRAP-$mysqld}"
+INSTALL_CMD="$scriptdir/mysql_install_db --no-defaults $EXTRA_ARG --basedir=$basedir --datadir=mysql-test/$ldata --srcdir=."
+echo "running $INSTALL_CMD"
-mysqld_boot="$mysqld_boot --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
+cd ..
+if $INSTALL_CMD
then
exit 0
else
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index 22290a88d39..2c563f23e5a 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -498,6 +498,17 @@ sub collect_one_test_case($$$$$$$) {
{
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
+ if ( defined $::used_default_engine )
+ {
+ # Different default engine is used
+ # tag test to require that engine
+ $tinfo->{'ndb_test'}= 1
+ if ( $::used_default_engine =~ /^ndb/i );
+
+ $tinfo->{'innodb_test'}= 1
+ if ( $::used_default_engine =~ /^innodb/i );
+ }
+
if ( $tinfo->{'big_test'} and ! $::opt_big_test )
{
$tinfo->{'skip'}= 1;
@@ -523,7 +534,7 @@ sub collect_one_test_case($$$$$$$) {
! ( $tinfo->{'binlog_format'} eq $::used_binlog_format ) )
{
$tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Not running with binlog format '$tinfo->{'binlog_format'}'";
+ $tinfo->{'comment'}= "Requiring binlog format '$tinfo->{'binlog_format'}'";
return;
}
@@ -588,7 +599,7 @@ our @tags=
(
["include/have_innodb.inc", "innodb_test", 1],
["include/have_binlog_format_row.inc", "binlog_format", "row"],
- ["include/have_binlog_format_statement.inc", "binlog_format", "stmt"],
+ ["include/have_binlog_format_statement.inc", "binlog_format", "statement"],
["include/have_binlog_format_mixed.inc", "binlog_format", "mixed"],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 690ca8313dd..53bf37bcc83 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -38,8 +38,8 @@ sub mtr_kill_processes ($);
sub mtr_ping_with_timeout($);
sub mtr_ping_port ($);
-# static in C
-sub spawn_impl ($$$$$$$$);
+# Local function
+sub spawn_impl ($$$$$$$);
##############################################################################
#
@@ -47,18 +47,16 @@ sub spawn_impl ($$$$$$$$);
#
##############################################################################
-# This function try to mimic the C version used in "netware/mysql_test_run.c"
-
sub mtr_run ($$$$$$;$) {
my $path= shift;
my $arg_list_t= shift;
my $input= shift;
my $output= shift;
my $error= shift;
- my $pid_file= shift;
+ my $pid_file= shift; # Not used
my $spawn_opts= shift;
- return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file,
+ return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,
$spawn_opts);
}
@@ -68,10 +66,10 @@ sub mtr_run_test ($$$$$$;$) {
my $input= shift;
my $output= shift;
my $error= shift;
- my $pid_file= shift;
+ my $pid_file= shift; # Not used
my $spawn_opts= shift;
- return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file,
+ return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,
$spawn_opts);
}
@@ -81,28 +79,22 @@ sub mtr_spawn ($$$$$$;$) {
my $input= shift;
my $output= shift;
my $error= shift;
- my $pid_file= shift;
+ my $pid_file= shift; # Not used
my $spawn_opts= shift;
- return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file,
+ return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,
$spawn_opts);
}
-##############################################################################
-#
-# If $join is set, we return the error code, else we return the PID
-#
-##############################################################################
-sub spawn_impl ($$$$$$$$) {
+sub spawn_impl ($$$$$$$) {
my $path= shift;
my $arg_list_t= shift;
my $mode= shift;
my $input= shift;
my $output= shift;
my $error= shift;
- my $pid_file= shift; # FIXME
my $spawn_opts= shift;
if ( $::opt_script_debug )
@@ -155,10 +147,6 @@ sub spawn_impl ($$$$$$$$) {
else
{
# Child, redirect output and exec
- # FIXME I tried POSIX::setsid() here to detach and, I hoped,
- # avoid zombies. But everything went wild, somehow the parent
- # became a deamon as well, and was hard to kill ;-)
- # Need to catch SIGCHLD and do waitpid or something instead......
$SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
@@ -196,7 +184,15 @@ sub spawn_impl ($$$$$$$$) {
}
else
{
- if ( ! open(STDERR,$log_file_open_mode,$error) )
+ if ( $::glob_win32_perl )
+ {
+ # Don't redirect stdout on ActiveState perl since this is
+ # just another thread in the same process.
+ # Should be fixed so that the thread that is created with fork
+ # executes the exe in another process and wait's for it to return.
+ # In the meanwhile, we get all the output from mysqld's to screen
+ }
+ elsif ( ! open(STDERR,$log_file_open_mode,$error) )
{
mtr_child_error("can't redirect STDERR to \"$error\": $!");
}
@@ -259,9 +255,7 @@ sub spawn_parent_impl {
# We do blocking waitpid() until we get the return from the
# "mysqltest" call. But if a mysqld process dies that we
# started, we take this as an error, and kill mysqltest.
- #
- # FIXME is this as it should be? Can't mysqld terminate
- # normally from running a test case?
+
my $exit_value= -1;
my $saved_exit_value;
@@ -450,7 +444,6 @@ sub mtr_kill_leftovers () {
# We scan the "var/run/" directory for other process id's to kill
- # FIXME $path_run_dir or something
my $rundir= "$::opt_vardir/run";
mtr_debug("Processing PID files in directory '$rundir'...");
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 3e51bee7c8a..7f775bd0942 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -305,6 +305,7 @@ our $path_sql_dir;
our @data_dir_lst;
our $used_binlog_format;
+our $used_default_engine;
our $debug_compiled_binaries;
our $glob_tot_real_time= 0;
@@ -354,7 +355,7 @@ sub do_before_start_slave ($);
sub ndbd_start ($$$);
sub ndb_mgmd_start ($);
sub mysqld_start ($$$);
-sub mysqld_arguments ($$$$$);
+sub mysqld_arguments ($$$$);
sub stop_all_servers ();
sub run_mysqltest ($);
sub usage ($);
@@ -520,7 +521,7 @@ sub command_line_setup () {
'compress' => \$opt_compress,
'bench' => \$opt_bench,
'small-bench' => \$opt_small_bench,
- 'with-ndbcluster' => \$opt_with_ndbcluster,
+ 'with-ndbcluster|ndb' => \$opt_with_ndbcluster,
'vs-config' => \$opt_vs_config,
# Control what test suites or cases to run
@@ -777,6 +778,26 @@ sub command_line_setup () {
mtr_report("Using binlog format '$used_binlog_format'");
}
+
+ # --------------------------------------------------------------------------
+ # Find out default storage engine being used(if any)
+ # --------------------------------------------------------------------------
+ if ( $opt_with_ndbcluster )
+ {
+ # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster
+ push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster");
+ }
+
+ foreach my $arg ( @opt_extra_mysqld_opt )
+ {
+ if ( $arg =~ /default-storage-engine=(\S+)/ )
+ {
+ $used_default_engine= $1;
+ }
+ }
+ mtr_report("Using default engine '$used_default_engine'")
+ if defined $used_default_engine;
+
# --------------------------------------------------------------------------
# Check if we should speed up tests by trying to run on tmpfs
# --------------------------------------------------------------------------
@@ -849,20 +870,22 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Check im suport
# --------------------------------------------------------------------------
- if (!$opt_extern)
+ if ($opt_extern)
{
- if ( $mysql_version_id < 50000 ) {
- # Instance manager is not supported until 5.0
- $opt_skip_im= 1;
-
- }
-
- if ( $glob_win32 ) {
- mtr_report("Disable Instance manager - not supported on Windows");
- $opt_skip_im= 1;
- }
-
+ mtr_report("Disable instance manager when running with extern mysqld");
+ $opt_skip_im= 1;
}
+ elsif ( $mysql_version_id < 50000 )
+ {
+ # Instance manager is not supported until 5.0
+ $opt_skip_im= 1;
+ }
+ elsif ( $glob_win32 )
+ {
+ mtr_report("Disable Instance manager - testing not supported on Windows");
+ $opt_skip_im= 1;
+ }
+
# --------------------------------------------------------------------------
# Record flag
# --------------------------------------------------------------------------
@@ -900,10 +923,6 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Ndb cluster flags
# --------------------------------------------------------------------------
- if ( $opt_with_ndbcluster and !$opt_bench)
- {
- mtr_error("Can only use --with-ndbcluster togheter with --bench");
- }
if ( $opt_ndbconnectstring )
{
@@ -1056,8 +1075,6 @@ sub command_line_setup () {
# socket path names.
$sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) > 80 );
- # Put this into a hash, will be a C struct
-
$master->[0]=
{
pid => 0,
@@ -1065,7 +1082,6 @@ sub command_line_setup () {
idx => 0,
path_myddir => "$opt_vardir/master-data",
path_myerr => "$opt_vardir/log/master.err",
- path_mylog => "$opt_vardir/log/master.log",
path_pid => "$opt_vardir/run/master.pid",
path_sock => "$sockdir/master.sock",
port => $opt_master_myport,
@@ -1081,7 +1097,6 @@ sub command_line_setup () {
idx => 1,
path_myddir => "$opt_vardir/master1-data",
path_myerr => "$opt_vardir/log/master1.err",
- path_mylog => "$opt_vardir/log/master1.log",
path_pid => "$opt_vardir/run/master1.pid",
path_sock => "$sockdir/master1.sock",
port => $opt_master_myport + 1,
@@ -1097,7 +1112,6 @@ sub command_line_setup () {
idx => 0,
path_myddir => "$opt_vardir/slave-data",
path_myerr => "$opt_vardir/log/slave.err",
- path_mylog => "$opt_vardir/log/slave.log",
path_pid => "$opt_vardir/run/slave.pid",
path_sock => "$sockdir/slave.sock",
port => $opt_slave_myport,
@@ -1114,7 +1128,6 @@ sub command_line_setup () {
idx => 1,
path_myddir => "$opt_vardir/slave1-data",
path_myerr => "$opt_vardir/log/slave1.err",
- path_mylog => "$opt_vardir/log/slave1.log",
path_pid => "$opt_vardir/run/slave1.pid",
path_sock => "$sockdir/slave1.sock",
port => $opt_slave_myport + 1,
@@ -1130,7 +1143,6 @@ sub command_line_setup () {
idx => 2,
path_myddir => "$opt_vardir/slave2-data",
path_myerr => "$opt_vardir/log/slave2.err",
- path_mylog => "$opt_vardir/log/slave2.log",
path_pid => "$opt_vardir/run/slave2.pid",
path_sock => "$sockdir/slave2.sock",
port => $opt_slave_myport + 2,
@@ -1334,7 +1346,7 @@ sub collect_mysqld_features () {
#
# Execute "mysqld --no-defaults --help --verbose" to get a
- # of all features and settings
+ # list of all features and settings
#
my $list= `$exe_mysqld --no-defaults --verbose --help`;
@@ -1398,6 +1410,40 @@ sub collect_mysqld_features () {
}
+sub run_query($$) {
+ my ($mysqld, $query)= @_;
+
+ my $args;
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--user=%s", $opt_user);
+ mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
+ mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
+ mtr_add_arg($args, "--silent"); # Tab separated output
+ mtr_add_arg($args, "-e '%s'", $query);
+
+ my $cmd= "$exe_mysql " . join(' ', @$args);
+ mtr_verbose("cmd: $cmd");
+ return `$cmd`;
+}
+
+
+sub collect_mysqld_features_from_running_server ()
+{
+ my $list= run_query($master->[0], "use mysql; SHOW VARIABLES");
+
+ foreach my $line (split('\n', $list))
+ {
+ # Put variables into hash
+ if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
+ {
+ print "$1=\"$2\"\n";
+ $mysqld_variables{$1}= $2;
+ }
+ }
+}
+
sub executable_setup_im () {
# Look for instance manager binary - mysqlmanager
@@ -1495,9 +1541,17 @@ sub executable_setup () {
if (!$opt_extern)
{
- # Look for SQL scripts directory
- $path_sql_dir= mtr_path_exists("$glob_basedir/share",
- "$glob_basedir/scripts");
+ # Look for SQL scripts directory
+ if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
+ {
+ # The SQL scripts are in path_share
+ $path_sql_dir= $path_share;
+ }
+ else
+ {
+ $path_sql_dir= mtr_path_exists("$glob_basedir/share",
+ "$glob_basedir/scripts");
+ }
if ( $mysql_version_id >= 50100 )
{
@@ -1877,8 +1931,7 @@ sub environment_setup () {
mtr_native_path($exe_mysqlslap) .
" -uroot " .
"--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password= " .
- "--lock-directory=$opt_tmpdir";
+ "--socket=$master->[0]->{'path_sock'} --password= ";
if ( $opt_debug )
{
@@ -1926,7 +1979,7 @@ sub environment_setup () {
# ----------------------------------------------------
my $cmdline_mysqlbinlog=
mtr_native_path($exe_mysqlbinlog) .
- " --no-defaults --disable-force-if-open --debug-info --local-load=$opt_tmpdir";
+ " --no-defaults --disable-force-if-open --debug-info";
if ( !$opt_extern && $mysql_version_id >= 50000 )
{
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
@@ -2795,10 +2848,7 @@ sub initialize_servers () {
}
else
{
- if ($opt_verbose)
- {
- mtr_report("No need to create '$opt_vardir' it already exists");
- }
+ mtr_verbose("No need to create '$opt_vardir' it already exists");
}
}
else
@@ -3228,9 +3278,9 @@ sub do_after_run_mysqltest($)
}
-sub run_testcase_mark_logs($)
+sub run_testcase_mark_logs($$)
{
- my ($log_msg)= @_;
+ my ($tinfo, $log_msg)= @_;
# Write a marker to all log files
@@ -3243,6 +3293,12 @@ sub run_testcase_mark_logs($)
mtr_tofile($mysqld->{path_myerr}, $log_msg);
}
+ if ( $tinfo->{'component_id'} eq 'im')
+ {
+ mtr_tofile($instance_manager->{path_err}, $log_msg);
+ mtr_tofile($instance_manager->{path_log}, $log_msg);
+ }
+
# ndbcluster log file
mtr_tofile($path_ndb_testrun_log, $log_msg);
@@ -3369,7 +3425,7 @@ sub run_testcase ($) {
}
# Write to all log files to indicate start of testcase
- run_testcase_mark_logs("CURRENT_TEST: $tinfo->{name}\n");
+ run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n");
my $died= mtr_record_dead_children();
if ($died or $master_restart or $slave_restart)
@@ -3443,7 +3499,7 @@ sub run_testcase ($) {
# Stop Instance Manager if we are processing an IM-test case.
# ----------------------------------------------------------------------
if ( $tinfo->{'component_id'} eq 'im' and
- !mtr_im_stop($instance_manager, $tinfo->{'name'}) )
+ !mtr_im_stop($instance_manager, $tinfo->{'name'}))
{
mtr_error("Failed to stop Instance Manager.")
}
@@ -3628,21 +3684,20 @@ sub do_before_start_slave ($) {
}
-sub mysqld_arguments ($$$$$) {
+sub mysqld_arguments ($$$$) {
my $args= shift;
- my $type= shift;
- my $idx= shift;
+ my $mysqld= shift;
my $extra_opt= shift;
my $slave_master_info= shift;
+ my $idx= $mysqld->{'idx'};
my $sidx= ""; # Index as string, 0 is empty string
- if ( $idx > 0 )
+ if ( $idx> 0 )
{
- $sidx= "$idx";
+ $sidx= $idx;
}
my $prefix= ""; # If mysqltest server arg
-
if ( $glob_use_embedded_server )
{
$prefix= "--server-arg=";
@@ -3656,8 +3711,16 @@ sub mysqld_arguments ($$$$$) {
if ( $mysql_version_id >= 50036)
{
- # Prevent the started mysqld to access files outside of vardir
- mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
+ # By default, prevent the started mysqld to access files outside of vardir
+ my $secure_file_dir= $opt_vardir;
+ if ( $opt_suite ne "main" )
+ {
+ # When running a suite other than default allow the mysqld
+ # access to subdirs of mysql-test/ in order to make it possible
+ # to "load data" from the suites data/ directory.
+ $secure_file_dir= $glob_mysql_test_dir;
+ }
+ mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $secure_file_dir);
}
if ( $mysql_version_id >= 50000 )
@@ -3679,36 +3742,55 @@ sub mysqld_arguments ($$$$$) {
}
}
+ mtr_add_arg($args, "%s--pid-file=%s", $prefix,
+ $mysqld->{'path_pid'});
+
+ mtr_add_arg($args, "%s--port=%d", $prefix,
+ $mysqld->{'port'});
+
+ mtr_add_arg($args, "%s--socket=%s", $prefix,
+ $mysqld->{'path_sock'});
+
+ mtr_add_arg($args, "%s--datadir=%s", $prefix,
+ $mysqld->{'path_myddir'});
+
+
+ if ( $mysql_version_id >= 50106 )
+ {
+ # Turn on logging to bothe tables and file
+ mtr_add_arg($args, "%s--log-output=table,file", $prefix);
+ }
+
+ my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
+ mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
+ mtr_add_arg($args,
+ "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
+
# Check if "extra_opt" contains --skip-log-bin
my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt);
- if ( $type eq 'master' )
+ if ( $mysqld->{'type'} eq 'master' )
{
- my $id= $idx > 0 ? $idx + 101 : 1;
-
if (! ($opt_skip_master_binlog || $skip_binlog) )
{
mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix,
$opt_vardir, $sidx);
}
- mtr_add_arg($args, "%s--pid-file=%s", $prefix,
- $master->[$idx]->{'path_pid'});
- mtr_add_arg($args, "%s--port=%d", $prefix,
- $master->[$idx]->{'port'});
- mtr_add_arg($args, "%s--server-id=%d", $prefix, $id);
- mtr_add_arg($args, "%s--socket=%s", $prefix,
- $master->[$idx]->{'path_sock'});
- mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:10M:autoextend", $prefix);
+
+ mtr_add_arg($args, "%s--server-id=%d", $prefix,
+ $idx > 0 ? $idx + 101 : 1);
+
+ mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:10M:autoextend",
+ $prefix);
+
mtr_add_arg($args, "%s--local-infile", $prefix);
- mtr_add_arg($args, "%s--datadir=%s", $prefix,
- $master->[$idx]->{'path_myddir'});
if ( $idx > 0 or !$use_innodb)
{
mtr_add_arg($args, "%s--skip-innodb", $prefix);
}
- my $cluster= $clusters->[$master->[$idx]->{'cluster'}];
+ my $cluster= $clusters->[$mysqld->{'cluster'}];
if ( $opt_skip_ndbcluster ||
!$cluster->{'pid'})
{
@@ -3725,28 +3807,14 @@ sub mysqld_arguments ($$$$$) {
}
}
- if ( $mysql_version_id <= 50106 )
- {
- # Force mysqld to use log files up until 5.1.6
- mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
- }
- else
- {
- # Turn on logging, will be sent to tables
- mtr_add_arg($args, "%s--log=", $prefix);
- }
-
mtr_add_arg($args, "%s--plugin_dir=%s", $prefix,
dirname($lib_example_plugin));
}
-
- if ( $type eq 'slave' )
+ else
{
- my $slave_server_id= 2 + $idx;
- my $slave_rpl_rank= $slave_server_id;
+ mtr_error("unknown mysqld type")
+ unless $mysqld->{'type'} eq 'slave';
- mtr_add_arg($args, "%s--datadir=%s", $prefix,
- $slave->[$idx]->{'path_myddir'});
mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix);
if (! ( $opt_skip_slave_binlog || $skip_binlog ))
{
@@ -3756,18 +3824,14 @@ sub mysqld_arguments ($$$$$) {
}
mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
- mtr_add_arg($args, "%s--pid-file=%s", $prefix,
- $slave->[$idx]->{'path_pid'});
- mtr_add_arg($args, "%s--port=%d", $prefix,
- $slave->[$idx]->{'port'});
+
mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix,
$opt_vardir, $sidx);
mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix);
mtr_add_arg($args, "%s--report-port=%d", $prefix,
- $slave->[$idx]->{'port'});
+ $mysqld->{'port'});
mtr_add_arg($args, "%s--report-user=root", $prefix);
mtr_add_arg($args, "%s--skip-innodb", $prefix);
- mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
mtr_add_arg($args, "%s--skip-slave-start", $prefix);
# Directory where slaves find the dumps generated by "load data"
@@ -3776,8 +3840,6 @@ sub mysqld_arguments ($$$$$) {
my $slave_load_path= "../tmp";
mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
$slave_load_path);
- mtr_add_arg($args, "%s--socket=%s", $prefix,
- $slave->[$idx]->{'path_sock'});
mtr_add_arg($args, "%s--set-variable=slave_net_timeout=10", $prefix);
if ( @$slave_master_info )
@@ -3795,13 +3857,16 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--master-password=", $prefix);
mtr_add_arg($args, "%s--master-port=%d", $prefix,
$master->[0]->{'port'}); # First master
+
+ my $slave_server_id= 2 + $idx;
+ my $slave_rpl_rank= $slave_server_id;
mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
}
if ( $opt_skip_ndbcluster_slave ||
- $slave->[$idx]->{'cluster'} == -1 ||
- !$clusters->[$slave->[$idx]->{'cluster'}]->{'pid'} )
+ $mysqld->{'cluster'} == -1 ||
+ !$clusters->[$mysqld->{'cluster'}]->{'pid'} )
{
mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
}
@@ -3809,41 +3874,21 @@ sub mysqld_arguments ($$$$$) {
{
mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
- $clusters->[$slave->[$idx]->{'cluster'}]->{'connect_string'});
+ $clusters->[$mysqld->{'cluster'}]->{'connect_string'});
+
if ( $mysql_version_id >= 50100 )
{
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
}
}
-
- if ( $mysql_version_id <= 50106 )
- {
- # Force mysqld to use log files up until 5.1.6
- mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
- }
- else
- {
- # Turn on logging, will be sent to tables
- mtr_add_arg($args, "%s--log=", $prefix);
- }
-
} # end slave
if ( $opt_debug )
{
- if ( $type eq 'master' )
- {
- mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/master%s.trace",
- $prefix, $path_vardir_trace, $sidx);
- }
- if ( $type eq 'slave' )
- {
- mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/slave%s.trace",
- $prefix, $path_vardir_trace, $sidx);
- }
+ mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace",
+ $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx);
}
- # FIXME always set nowdays??? SMALL_SERVER
mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
@@ -3869,18 +3914,10 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--gdb", $prefix);
}
- # If we should run all tests cases, we will use a local server for that
-
- if ( -w "/" )
- {
- # We are running as root; We need to add the --root argument
- mtr_add_arg($args, "%s--user=root", $prefix);
- }
-
my $found_skip_core= 0;
foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt )
{
- # Allow --skip-core-file to be set in master.opt file
+ # Allow --skip-core-file to be set in <testname>-[master|slave].opt file
if ($arg eq "--skip-core-file")
{
$found_skip_core= 1;
@@ -3904,7 +3941,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix);
mtr_add_arg($args, "%s--init-rpl-role=master", $prefix);
}
- elsif ( $type eq 'master' )
+ elsif ( $mysqld->{'type'} eq 'master' )
{
mtr_add_arg($args, "%s--open-files-limit=1024", $prefix);
}
@@ -3955,7 +3992,7 @@ sub mysqld_start ($$$) {
valgrind_arguments($args, \$exe);
}
- mysqld_arguments($args,$type,$idx,$extra_opt,$slave_master_info);
+ mysqld_arguments($args,$mysqld,$extra_opt,$slave_master_info);
if ( $opt_gdb || $opt_manual_gdb)
{
@@ -4700,7 +4737,7 @@ sub run_mysqltest ($) {
if ( $glob_use_embedded_server )
{
- mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]);
+ mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]);
}
# ----------------------------------------------------------------------
@@ -5030,7 +5067,7 @@ Options to control what engine/variation to run
skip-ssl Dont start server with support for ssl connections
bench Run the benchmark suite
small-bench Run the benchmarks with --small-tests --small-tables
- with-ndbcluster Use cluster as default table type for benchmark
+ ndb|with-ndbcluster Use cluster as default table type
vs-config Visual Studio configuration used to create executables
(default: MTR_VS_CONFIG environment variable)
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index 1e25cd8047e..2d550294c84 100644
--- a/mysql-test/ndb/ndbcluster.sh
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -35,8 +35,8 @@ if [ -d ../sql ] ; then
exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd
exec_waiter=$ndbtop/tools/ndb_waiter
exec_test=$ndbtop/tools/ndb_test_platform
- exec_test_ndberror=
exec_test_ndberror=$ndbtop/src/ndbapi/ndberror_check
+ exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgm
else
BINARY_DIST=1
if test -x "$BASEDIR/libexec/ndbd"
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 571ac8498b3..fa18b58a927 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -881,6 +881,42 @@ 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 (a varchar(500));
+ALTER TABLE t1 ADD b GEOMETRY NOT NULL, ADD SPATIAL INDEX(b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(500) DEFAULT NULL,
+ `b` geometry NOT NULL,
+ SPATIAL KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 ADD KEY(b(50));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(500) DEFAULT NULL,
+ `b` geometry NOT NULL,
+ SPATIAL KEY `b` (`b`),
+ KEY `b_2` (`b`(50))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 ADD c POINT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(500) DEFAULT NULL,
+ `b` geometry NOT NULL,
+ `c` point DEFAULT NULL,
+ SPATIAL KEY `b` (`b`),
+ KEY `b_2` (`b`(50))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+CREATE TABLE t2 (a INT, KEY (a(20)));
+ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
+ALTER TABLE t1 ADD d INT;
+ALTER TABLE t1 ADD KEY (d(20));
+ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
+ALTER TABLE t1 ADD e GEOMETRY NOT NULL, ADD SPATIAL KEY (e(30));
+ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
+DROP TABLE t1;
CREATE TABLE t1 (s CHAR(8) BINARY);
INSERT INTO t1 VALUES ('test');
SELECT LENGTH(s) FROM t1;
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
index 6ba8191e2c3..59462e848d2 100644
--- a/mysql-test/r/archive.result
+++ b/mysql-test/r/archive.result
@@ -12666,3 +12666,12 @@ t6 CREATE TABLE `t6` (
KEY `a` (`a`)
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
DROP TABLE t1, t2, t4, t5, t6;
+create table t1 (i int) engine=archive;
+insert into t1 values (1);
+repair table t1 use_frm;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+select * from t1;
+i
+1
+drop table t1;
diff --git a/mysql-test/r/archive_gis.result b/mysql-test/r/archive_gis.result
index 210140ea11b..6f8175bd609 100644
--- a/mysql-test/r/archive_gis.result
+++ b/mysql-test/r/archive_gis.result
@@ -393,7 +393,7 @@ 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
+120 121 0 0 1 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,
@@ -460,3 +460,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
+End of 4.1 tests
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/binlog_row_binlog.result b/mysql-test/r/binlog_row_binlog.result
index 769f23ea86c..6fcaad010d2 100644
--- a/mysql-test/r/binlog_row_binlog.result
+++ b/mysql-test/r/binlog_row_binlog.result
@@ -8,25 +8,25 @@ commit;
begin;
insert t2 values (5);
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=innodb
+master-bin.000001 # Query # # use `test`; create table t2 (a int) engine=innodb
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # 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;
+show binlog events in 'master-bin.000001' from 106;
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
@@ -232,7 +232,7 @@ 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;
+show binlog events in 'master-bin.000002' from 106;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Query 1 # use `test`; drop table t1
reset master;
@@ -254,58 +254,58 @@ INSERT INTO user SET host='localhost', user='@#@', password=password('Just a tes
UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@';
DELETE FROM user WHERE host='localhost' AND user='@#@';
use test;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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)
-master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
+master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
`a` int(11) DEFAULT NULL
)
-master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
+master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
`a` int(11) DEFAULT NULL
)
-master-bin.000001 # Table_map 1 # table_id: # (mysql.user)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Table_map 1 # table_id: # (mysql.user)
-master-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Table_map 1 # table_id: # (mysql.user)
-master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
drop table t1,t2,t3,tt1;
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;
+show binlog events from <binlog_start>;
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)
-master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
+master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
`a` int(11) DEFAULT NULL
)
-master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
+master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
`a` int(11) DEFAULT NULL
)
-master-bin.000001 # Table_map 1 # table_id: # (mysql.user)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Table_map 1 # table_id: # (mysql.user)
-master-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Table_map 1 # table_id: # (mysql.user)
-master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
-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
+master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
+master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # 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
@@ -323,3 +323,17 @@ a
400
401
drop table t1;
+reset master;
+drop table if exists t3;
+create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 346
+insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+show master status /* must show new binlog index after rotating */;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000002 106
+drop table t3;
diff --git a/mysql-test/r/binlog_row_blackhole.result b/mysql-test/r/binlog_row_blackhole.result
index f370232e2c3..8e90ac4f30b 100644
--- a/mysql-test/r/binlog_row_blackhole.result
+++ b/mysql-test/r/binlog_row_blackhole.result
@@ -104,23 +104,22 @@ select * from t2;
a
select * from t3;
a
-show binlog events;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; drop table t1,t2
+master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; alter table t1 add b int
+master-bin.000001 # Query # # use `test`; alter table t1 drop b
+master-bin.000001 # Query # # use `test`; create table t3 like t1
drop table t1,t2,t3;
CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE;
DELETE FROM t1 WHERE a=10;
@@ -143,12 +142,11 @@ start transaction;
insert into t1 values(2);
rollback;
set autocommit=1;
-show binlog events;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; COMMIT
drop table if exists t1;
diff --git a/mysql-test/r/binlog_row_ctype_ucs.result b/mysql-test/r/binlog_row_ctype_ucs.result
index 4eeff79e13a..4f4e7bcedd7 100644
--- a/mysql-test/r/binlog_row_ctype_ucs.result
+++ b/mysql-test/r/binlog_row_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 102;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
diff --git a/mysql-test/r/binlog_row_drop_tmp_tbl.result b/mysql-test/r/binlog_row_drop_tmp_tbl.result
index 2b09fe069e3..503076d66d9 100644
--- a/mysql-test/r/binlog_row_drop_tmp_tbl.result
+++ b/mysql-test/r/binlog_row_drop_tmp_tbl.result
@@ -11,8 +11,7 @@ get_lock("a",10)
select get_lock("a",10);
get_lock("a",10)
1
-show binlog events;
+show binlog events from <binlog_start>;
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`
+master-bin.000001 # Query # # create database `drop-temp+table-test`
drop database `drop-temp+table-test`;
diff --git a/mysql-test/r/binlog_row_insert_select.result b/mysql-test/r/binlog_row_insert_select.result
index 14cef6709b6..cd6ddafc47b 100644
--- a/mysql-test/r/binlog_row_insert_select.result
+++ b/mysql-test/r/binlog_row_insert_select.result
@@ -6,11 +6,10 @@ 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;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
select * from t1;
a
1
@@ -21,7 +20,6 @@ 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;
+show binlog events from <binlog_start>;
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
index 185ca33d4db..6ac942176c7 100644
--- a/mysql-test/r/binlog_row_mix_innodb_myisam.result
+++ b/mysql-test/r/binlog_row_mix_innodb_myisam.result
@@ -6,14 +6,14 @@ begin;
insert into t1 values(1);
insert into t2 select * from t1;
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -23,14 +23,14 @@ 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;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
@@ -43,18 +43,18 @@ rollback to savepoint my_savepoint;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; savepoint my_savepoint
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -72,20 +72,20 @@ select a from t1 order by a;
a
5
7
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; savepoint my_savepoint
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -98,52 +98,52 @@ insert into t2 select * from t1;
select get_lock("a",10);
get_lock("a",10)
1
-show binlog events from 102;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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;
+show binlog events from <binlog_start>;
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 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # 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;
+show binlog events from <binlog_start>;
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 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
insert into t1 values(11);
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
alter table t2 engine=INNODB;
delete from t1;
delete from t2;
@@ -152,14 +152,14 @@ begin;
insert into t1 values(12);
insert into t2 select * from t1;
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -167,7 +167,7 @@ begin;
insert into t1 values(13);
insert into t2 select * from t1;
rollback;
-show binlog events from 102;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
delete from t2;
@@ -179,12 +179,12 @@ insert into t1 values(15);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -200,14 +200,14 @@ select a from t1 order by a;
a
16
18
-show binlog events from 102;
+show binlog events from <binlog_start>;
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 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
alter table t2 engine=MyISAM;
@@ -252,30 +252,30 @@ insert into t2 values (3);
select get_lock("lock1",60);
get_lock("lock1",60)
1
-show binlog events from 102;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; alter table t2 engine=MyISAM
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; drop table t1,t2
+master-bin.000001 # Query # # use `test`; create table t0 (n int)
+master-bin.000001 # Table_map # # table_id: # (test.t0)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t0)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb
do release_lock("lock1");
drop table t0,t2;
set autocommit=0;
@@ -355,39 +355,39 @@ SELECT * from t2;
a b
100 100
DROP TABLE t1,t2;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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 */
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; TRUNCATE table t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t2
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; TRUNCATE table t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
reset master;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
diff --git a/mysql-test/r/binlog_statement_insert_delayed.result b/mysql-test/r/binlog_statement_insert_delayed.result
index 7a1b9a7ec9b..3a2dc441632 100644
--- a/mysql-test/r/binlog_statement_insert_delayed.result
+++ b/mysql-test/r/binlog_statement_insert_delayed.result
@@ -3,13 +3,13 @@ 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;
+show binlog events from <binlog_start>;
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)
+master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
+master-bin.000001 # Query # # use `test`; insert delayed into t1 values (207)
+master-bin.000001 # Intvar # # INSERT_ID=208
+master-bin.000001 # Query # # use `test`; insert delayed into t1 values (null)
+master-bin.000001 # Query # # 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
diff --git a/mysql-test/r/binlog_stm_binlog.result b/mysql-test/r/binlog_stm_binlog.result
index fb0453b5b68..66fe3e40270 100644
--- a/mysql-test/r/binlog_stm_binlog.result
+++ b/mysql-test/r/binlog_stm_binlog.result
@@ -4,11 +4,11 @@ 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 */
+master-bin.000001 4 Format_desc 1 106 Server ver: #, Binlog ver: #
+master-bin.000001 106 Query 1 213 use `test`; create table t1 (a int, b int) engine=innodb
+master-bin.000001 213 Query 1 281 use `test`; BEGIN
+master-bin.000001 281 Query 1 90 use `test`; insert into t1 values (1,2)
+master-bin.000001 371 Xid 1 398 COMMIT /* XID */
drop table t1;
drop table if exists t1, t2;
reset master;
@@ -20,23 +20,23 @@ commit;
begin;
insert t2 values (5);
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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 # Query 1 # use `test`; insert t1 values (5)
-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= */
+master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=innodb
+master-bin.000001 # Query # # use `test`; create table t2 (a int) engine=innodb
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert t1 values (5)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert t2 values (5)
+master-bin.000001 # Xid # # 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;
+show binlog events in 'master-bin.000001' from 106;
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
@@ -142,7 +142,7 @@ 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= */
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
-show binlog events in 'master-bin.000002' from 102;
+show binlog events in 'master-bin.000002' from 106;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Query 1 # use `test`; drop table t1
reset master;
@@ -164,46 +164,46 @@ INSERT INTO user SET host='localhost', user='@#@', password=password('Just a tes
UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@';
DELETE FROM user WHERE host='localhost' AND user='@#@';
use test;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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)
-master-bin.000001 # Query 1 # use `test`; create table if not exists t2 select * from t1
-master-bin.000001 # Query 1 # use `test`; create temporary table tt1 (a int)
-master-bin.000001 # Query 1 # use `test`; create table if not exists t3 like tt1
-master-bin.000001 # Query 1 # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
-master-bin.000001 # Query 1 # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
-master-bin.000001 # Query 1 # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
+master-bin.000001 # Intvar # # INSERT_ID=127
+master-bin.000001 # Query # # use `test`; insert into t1 values(null)
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Query # # use `test`; create table if not exists t2 select * from t1
+master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
+master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1
+master-bin.000001 # Query # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
+master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
drop table t1,t2,t3,tt1;
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;
+show binlog events from <binlog_start>;
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)
-master-bin.000001 # Query 1 # use `test`; create table if not exists t2 select * from t1
-master-bin.000001 # Query 1 # use `test`; create temporary table tt1 (a int)
-master-bin.000001 # Query 1 # use `test`; create table if not exists t3 like tt1
-master-bin.000001 # Query 1 # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
-master-bin.000001 # Query 1 # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
-master-bin.000001 # Query 1 # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
-master-bin.000001 # Query 1 # use `test`; drop table t1,t2,t3,tt1
-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
+master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
+master-bin.000001 # Intvar # # INSERT_ID=127
+master-bin.000001 # Query # # use `test`; insert into t1 values(null)
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Query # # use `test`; create table if not exists t2 select * from t1
+master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
+master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1
+master-bin.000001 # Query # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
+master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Query # # use `test`; drop table t1,t2,t3,tt1
+master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # 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
@@ -221,3 +221,17 @@ a
400
401
drop table t1;
+reset master;
+drop table if exists t3;
+create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 346
+insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+show master status /* must show new binlog index after rotating */;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000002 106
+drop table t3;
diff --git a/mysql-test/r/binlog_stm_blackhole.result b/mysql-test/r/binlog_stm_blackhole.result
index d382c94fba9..bf2fdfa616b 100644
--- a/mysql-test/r/binlog_stm_blackhole.result
+++ b/mysql-test/r/binlog_stm_blackhole.result
@@ -104,24 +104,23 @@ select * from t2;
a
select * from t3;
a
-show binlog events;
+show binlog events from <binlog_start>;
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 # Query 1 # use `test`; delete from t1 where a=10
-master-bin.000001 # Query 1 # use `test`; update t1 set a=11 where a=15
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(1)
-master-bin.000001 # Query 1 # use `test`; insert ignore into t1 values(1)
-master-bin.000001 # Query 1 # use `test`; replace into t1 values(100)
-master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
-master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
-master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=1
-master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
-master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
-master-bin.000001 # Query 1 # use `test`; create table t3 like t1
-master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3
-master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3
+master-bin.000001 # Query # # use `test`; drop table t1,t2
+master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole
+master-bin.000001 # Query # # use `test`; delete from t1 where a=10
+master-bin.000001 # Query # # use `test`; update t1 set a=11 where a=15
+master-bin.000001 # Query # # use `test`; insert into t1 values(1)
+master-bin.000001 # Query # # use `test`; insert ignore into t1 values(1)
+master-bin.000001 # Query # # use `test`; replace into t1 values(100)
+master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole
+master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=581
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=1
+master-bin.000001 # Query # # use `test`; alter table t1 add b int
+master-bin.000001 # Query # # use `test`; alter table t1 drop b
+master-bin.000001 # Query # # use `test`; create table t3 like t1
+master-bin.000001 # Query # # use `test`; insert into t1 select * from t3
+master-bin.000001 # Query # # use `test`; replace into t1 select * from t3
drop table t1,t2,t3;
CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE;
DELETE FROM t1 WHERE a=10;
@@ -144,11 +143,10 @@ start transaction;
insert into t1 values(2);
rollback;
set autocommit=1;
-show binlog events;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(1)
+master-bin.000001 # Query # # use `test`; COMMIT
drop table if exists t1;
diff --git a/mysql-test/r/binlog_stm_ctype_ucs.result b/mysql-test/r/binlog_stm_ctype_ucs.result
index 76f3a3b06b9..c789c618876 100644
--- a/mysql-test/r/binlog_stm_ctype_ucs.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 102;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-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)
+master-bin.000001 # User var # # @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
+master-bin.000001 # Query # # use `test`; insert into t2 values (@v)
flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
diff --git a/mysql-test/r/binlog_stm_drop_tmp_tbl.result b/mysql-test/r/binlog_stm_drop_tmp_tbl.result
index 96481341bd6..dc4349dea59 100644
--- a/mysql-test/r/binlog_stm_drop_tmp_tbl.result
+++ b/mysql-test/r/binlog_stm_drop_tmp_tbl.result
@@ -11,12 +11,11 @@ get_lock("a",10)
select get_lock("a",10);
get_lock("a",10)
1
-show binlog events;
+show binlog events from <binlog_start>;
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`
-master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn1 (a int)
-master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table `table:name` (a int)
-master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn2 (a int)
-master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1`
+master-bin.000001 # Query # # create database `drop-temp+table-test`
+master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table shortn1 (a int)
+master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table `table:name` (a int)
+master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table shortn2 (a int)
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1`
drop database `drop-temp+table-test`;
diff --git a/mysql-test/r/binlog_stm_insert_select.result b/mysql-test/r/binlog_stm_insert_select.result
index 646a76b254d..a93a8edf4aa 100644
--- a/mysql-test/r/binlog_stm_insert_select.result
+++ b/mysql-test/r/binlog_stm_insert_select.result
@@ -6,10 +6,9 @@ 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;
+show binlog events from <binlog_start>;
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 196 use `test`; insert into t1 select * from t2
+master-bin.000001 # Query # # use `test`; insert into t1 select * from t2
select * from t1;
a
1
@@ -20,7 +19,6 @@ 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;
+show binlog events from <binlog_start>;
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_stm_mix_innodb_myisam.result b/mysql-test/r/binlog_stm_mix_innodb_myisam.result
index 23f4e50826a..c74fb17d600 100644
--- a/mysql-test/r/binlog_stm_mix_innodb_myisam.result
+++ b/mysql-test/r/binlog_stm_mix_innodb_myisam.result
@@ -6,12 +6,12 @@ begin;
insert into t1 values(1);
insert into t2 select * from t1;
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(1)
+master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -21,12 +21,12 @@ 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;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(2)
+master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query # # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
@@ -39,15 +39,15 @@ rollback to savepoint my_savepoint;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(3)
+master-bin.000001 # Query # # use `test`; savepoint my_savepoint
+master-bin.000001 # Query # # use `test`; insert into t1 values(4)
+master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -65,16 +65,16 @@ select a from t1 order by a;
a
5
7
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(5)
+master-bin.000001 # Query # # use `test`; savepoint my_savepoint
+master-bin.000001 # Query # # use `test`; insert into t1 values(6)
+master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 # Query # # use `test`; insert into t1 values(7)
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -87,43 +87,43 @@ insert into t2 select * from t1;
select get_lock("a",10);
get_lock("a",10)
1
-show binlog events from 102;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(8)
+master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query # # 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;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; insert into t1 values(9)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # 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;
+show binlog events from <binlog_start>;
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 # # use `test`; insert into t1 values(10)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
insert into t1 values(11);
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; insert into t1 values(10)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(11)
+master-bin.000001 # Xid # # COMMIT /* XID */
alter table t2 engine=INNODB;
delete from t1;
delete from t2;
@@ -132,12 +132,12 @@ begin;
insert into t1 values(12);
insert into t2 select * from t1;
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(12)
+master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -145,7 +145,7 @@ begin;
insert into t1 values(13);
insert into t2 select * from t1;
rollback;
-show binlog events from 102;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
delete from t2;
@@ -157,11 +157,11 @@ insert into t1 values(15);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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= */
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(14)
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
@@ -177,12 +177,12 @@ select a from t1 order by a;
a
16
18
-show binlog events from 102;
+show binlog events from <binlog_start>;
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 # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(16)
+master-bin.000001 # Query # # use `test`; insert into t1 values(18)
+master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
alter table t2 engine=MyISAM;
@@ -227,31 +227,31 @@ insert into t2 values (3);
select get_lock("lock1",60);
get_lock("lock1",60)
1
-show binlog events from 102;
+show binlog events from <binlog_start>;
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`
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(16)
+master-bin.000001 # Query # # use `test`; insert into t1 values(18)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; delete from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; delete from t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; alter table t2 engine=MyISAM
+master-bin.000001 # Query # # use `test`; insert into t1 values (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; insert into t2 values (20)
+master-bin.000001 # Query # # use `test`; drop table t1,t2
+master-bin.000001 # Query # # use `test`; create temporary table ti (a int) engine=innodb
+master-bin.000001 # Query # # use `test`; insert into ti values(1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engine=myisam
+master-bin.000001 # Query # # use `test`; insert t1 values (1)
+master-bin.000001 # Query # # use `test`; create table t0 (n int)
+master-bin.000001 # Query # # use `test`; insert t0 select * from t1
+master-bin.000001 # Query # # use `test`; insert into t0 select GET_LOCK("lock1",null)
+master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb
+master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
do release_lock("lock1");
drop table t0,t2;
set autocommit=0;
@@ -331,30 +331,30 @@ SELECT * from t2;
a b
100 100
DROP TABLE t1,t2;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (1,1),(1,2)
+master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (3,3)
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4,4)
+master-bin.000001 # Query # # use `test`; TRUNCATE table t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5,5)
+master-bin.000001 # Query # # use `test`; DROP TABLE t2
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (6,6)
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (7,7)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (8,8)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (9,9)
+master-bin.000001 # Query # # use `test`; TRUNCATE table t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (10,10)
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1,t2
reset master;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
diff --git a/mysql-test/r/client_xml.result b/mysql-test/r/client_xml.result
index 7395b2433e8..ed5e8f2c1b8 100644
--- a/mysql-test/r/client_xml.result
+++ b/mysql-test/r/client_xml.result
@@ -7,7 +7,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<?xml version="1.0"?>
<resultset statement="select * from t1
-">
+" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="a&amp;b">1</field>
<field name="a&lt;b">2</field>
@@ -34,7 +34,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<?xml version="1.0"?>
<resultset statement="select count(*) from t1
-">
+" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="count(*)">1</field>
</row>
@@ -42,7 +42,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<?xml version="1.0"?>
<resultset statement="select 1 &lt; 2 from dual
-">
+" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="1 &lt; 2">1</field>
</row>
@@ -50,7 +50,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<?xml version="1.0"?>
<resultset statement="select 1 &gt; 2 from dual
-">
+" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="1 &gt; 2">0</field>
</row>
@@ -58,7 +58,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<?xml version="1.0"?>
<resultset statement="select 1 &amp; 3 from dual
-">
+" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="1 &amp; 3">1</field>
</row>
@@ -66,9 +66,23 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<?xml version="1.0"?>
<resultset statement="select null from dual
-">
+" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="NULL" xsi:nil="true" />
</row>
</resultset>
+<?xml version="1.0"?>
+
+<resultset statement="select 1 limit 0
+" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></resultset>
+--------------
+select 1 limit 0
+--------------
+
+<?xml version="1.0"?>
+
+<resultset statement="select 1 limit 0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></resultset>
+Empty set
+
+Bye
drop table t1;
diff --git a/mysql-test/r/compress.result b/mysql-test/r/compress.result
index 0aebc817146..11b15ed7675 100644
--- a/mysql-test/r/compress.result
+++ b/mysql-test/r/compress.result
@@ -1,6 +1,9 @@
SHOW STATUS LIKE 'Compression';
Variable_name Value
Compression ON
+select * from information_schema.session_status where variable_name= 'COMPRESSION';
+VARIABLE_NAME VARIABLE_VALUE
+COMPRESSION 1.0000000
drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
diff --git a/mysql-test/r/crash_commit_before.result b/mysql-test/r/crash_commit_before.result
index 8eba584c539..34fb3284bae 100644
--- a/mysql-test/r/crash_commit_before.result
+++ b/mysql-test/r/crash_commit_before.result
@@ -11,3 +11,4 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t1;
a
+DROP TABLE t1;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index ab9e6762d21..c7f8ba17930 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -460,8 +460,8 @@ t2 CREATE TABLE `t2` (
`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(f,f)` float(3,2) DEFAULT NULL,
+ `ifnull(g,g)` double(4,3) DEFAULT NULL,
`ifnull(h,h)` decimal(5,4) DEFAULT NULL,
`ifnull(i,i)` year(4) DEFAULT NULL,
`ifnull(j,j)` date DEFAULT NULL,
@@ -784,6 +784,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (upgrade int);
drop table t1;
+End of 5.0 tests
CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2);
CREATE TABLE t2 (primary key (a)) select * from t1;
@@ -827,7 +828,7 @@ ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
-ERROR 42000: Unknown database 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+ERROR 42000: Unknown database 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
create database mysqltest;
@@ -838,3 +839,103 @@ USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+set names utf8;
+create database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+use имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+select database();
+database()
+имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45
+use test;
+select SCHEMA_NAME from information_schema.schemata
+where schema_name='имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45';
+SCHEMA_NAME
+имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45
+drop database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48
+(
+имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45 int,
+index имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48 (имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45)
+);
+create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42 as
+select имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+select * from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+select TABLE_NAME from information_schema.tables where
+table_schema='test';
+TABLE_NAME
+имÑ_вью_кодировке_утф8_длиной_больше_чем_42
+имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48
+select COLUMN_NAME from information_schema.columns where
+table_schema='test';
+COLUMN_NAME
+имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+select INDEX_NAME from information_schema.statistics where
+table_schema='test';
+INDEX_NAME
+имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48
+select TABLE_NAME from information_schema.views where
+table_schema='test';
+TABLE_NAME
+имÑ_вью_кодировке_утф8_длиной_больше_чем_42
+show create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+Table Create Table
+имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 CREATE TABLE `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48` (
+ `имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` int(11) DEFAULT NULL,
+ KEY `имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48` (`имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
+View Create View
+имÑ_вью_кодировке_утф8_длиной_больше_чем_42 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `имÑ_вью_кодировке_утф8_длиной_больше_чем_42` AS select `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48`.`имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` AS `имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` from `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48`
+create event имÑ_ÑобытиÑ_в_кодировке_утф8_длиной_больше_чем_48 on schedule every 2 year do select 1;
+select EVENT_NAME from information_schema.events
+where event_schema='test';
+EVENT_NAME
+имÑ_ÑобытиÑ_в_кодировке_утф8_длиной_больше_чем_48
+drop event имÑ_ÑобытиÑ_в_кодировке_утф8_длиной_больше_чем_48;
+create event
+очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66
+on schedule every 2 year do select 1;
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+create trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49
+before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
+select TRIGGER_NAME from information_schema.triggers where
+trigger_schema='test';
+TRIGGER_NAME
+имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49
+drop trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49;
+create trigger
+очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66
+before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66;
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+create procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
+begin
+end;
+select ROUTINE_NAME from information_schema.routines where
+routine_schema='test';
+ROUTINE_NAME
+имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50
+drop procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
+create procedure очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
+begin
+end;
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+create function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49()
+returns int
+return 0;
+select ROUTINE_NAME from information_schema.routines where
+routine_schema='test';
+ROUTINE_NAME
+имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49
+drop function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49;
+create function очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
+returns int
+return 0;
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+drop view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
+drop table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+set names default;
+End of 5.1 tests
diff --git a/mysql-test/r/ctype_cp932_binlog_row.result b/mysql-test/r/ctype_cp932_binlog_row.result
index f1a64241fbb..39d7727b58a 100644
--- a/mysql-test/r/ctype_cp932_binlog_row.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 102;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index ef024e2fa20..b486d2faaa9 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.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 102;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-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')
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
+master-bin.000001 # User var # # @`var1`=_binary 0x8300 COLLATE binary
+master-bin.000001 # Query # # 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 406|
+SHOW BINLOG EVENTS FROM 410|
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 406 Query 1 572 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
+master-bin.000001 410 Query 1 576 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))
-master-bin.000001 572 Query 1 820 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE bug18293 (IN ins1 CHAR(50),
+master-bin.000001 576 Query 1 824 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 820 Query 1 1039 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
-master-bin.000001 1039 Query 1 1128 use `test`; DROP PROCEDURE bug18293
-master-bin.000001 1128 Query 1 1207 use `test`; DROP TABLE t4
+master-bin.000001 824 Query 1 1043 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
+master-bin.000001 1043 Query 1 1132 use `test`; DROP PROCEDURE bug18293
+master-bin.000001 1132 Query 1 1211 use `test`; DROP TABLE t4
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index 3e286c77c00..1fd1493bf1e 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -2654,3 +2654,12 @@ ii 2 ii 2 Ä°Ä° 4
Ä°Ä° 4 ii 2 Ä°Ä° 4
II 2 ıı 4 II 2
DROP TABLE t1;
+CREATE TABLE t1 (
+c1 text character set ucs2 collate ucs2_polish_ci NOT NULL
+) ENGINE=MyISAM;
+insert into t1 values (''),('a');
+SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
+COUNT(*) c1
+1
+1 a
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index a65b19695ec..fcfe5d6345b 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -839,6 +839,24 @@ lily
river
drop table t1;
deallocate prepare stmt;
+set names latin1;
+set character_set_connection=ucs2;
+select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
+soundex('') soundex('he') soundex('hello all folks') soundex('#3556 in bugdb')
+ H000 H4142 I51231
+select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb'));
+hex(soundex('')) hex(soundex('he')) hex(soundex('hello all folks')) hex(soundex('#3556 in bugdb'))
+ 0048003000300030 00480034003100340032 004900350031003200330031
+select 'mood' sounds like 'mud';
+'mood' sounds like 'mud'
+1
+select hex(soundex(_ucs2 0x041004110412));
+hex(soundex(_ucs2 0x041004110412))
+0410003000300030
+select hex(soundex(_ucs2 0x00BF00C0));
+hex(soundex(_ucs2 0x00BF00C0))
+00C0003000300030
+set names latin1;
create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1';
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 37ef5e2756f..d76d89d5630 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -854,6 +854,18 @@ select * from t1 where soundex(a) = soundex('test');
id a
1 Test
drop table t1;
+select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB);
+soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)
+阅000
+select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB));
+hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB))
+E99885303030
+select soundex(_utf8 0xD091D092D093);
+soundex(_utf8 0xD091D092D093)
+Б000
+select hex(soundex(_utf8 0xD091D092D093));
+hex(soundex(_utf8 0xD091D092D093))
+D091303030
SET collation_connection='utf8_general_ci';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -1468,6 +1480,49 @@ aa
xxx
yyy
DROP TABLE t1;
+create table t1 (
+a varchar(26) not null
+) default character set utf8;
+insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
+select * from t1;
+a
+abcdefghijklmnopqrstuvwxyz
+alter table t1 change a a varchar(20) character set utf8 not null;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+select * from t1;
+a
+abcdefghijklmnopqrst
+alter table t1 change a a char(15) character set utf8 not null;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+select * from t1;
+a
+abcdefghijklmno
+alter table t1 change a a char(10) character set utf8 not null;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+select * from t1;
+a
+abcdefghij
+alter table t1 change a a varchar(5) character set utf8 not null;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+select * from t1;
+a
+abcde
+drop table t1;
+create table t1 (
+a varchar(4000) not null
+) default character set utf8;
+insert into t1 values (repeat('a',4000));
+alter table t1 change a a varchar(3000) character set utf8 not null;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+select length(a) from t1;
+length(a)
+3000
+drop table t1;
set names utf8;
select hex(char(1 using utf8));
hex(char(1 using utf8))
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index cf3495ef26d..7375260d863 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -91,6 +91,8 @@ create table t1 (date char(30), format char(30) not null);
insert into t1 values
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
+('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
+('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
@@ -122,6 +124,8 @@ select date,format,str_to_date(date, format) as str_to_date from t1;
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 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
@@ -153,6 +157,8 @@ select date,format,concat('',str_to_date(date, format)) as con from t1;
date format con
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
@@ -184,17 +190,19 @@ select date,format,cast(str_to_date(date, format) as datetime) as datetime from
date format datetime
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
-10:20:10 %H:%i:%s 0000-00-00 00:00:00
-10:20:10 %h:%i:%s.%f 0000-00-00 00:00:00
-10:20:10 %T 0000-00-00 00:00:00
-10:20:10AM %h:%i:%s%p 0000-00-00 00:00:00
-10:20:10AM %r 0000-00-00 00:00:00
-10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 00:00:00
+10:20:10 %H:%i:%s 0000-00-00 10:20:10
+10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
+10:20:10 %T 0000-00-00 10:20:10
+10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
+10:20:10AM %r 0000-00-00 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
15 September 2001 %d %M %Y 2001-09-15 00:00:00
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
@@ -211,17 +219,12 @@ Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
15-01-20 %d-%m-%y 2020-01-15 00:00:00
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
-Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10.440000'
select date,format,DATE(str_to_date(date, format)) as date2 from t1;
date format date2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02
@@ -253,17 +256,19 @@ select date,format,TIME(str_to_date(date, format)) as time from t1;
date format time
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
-10:20:10 %H:%i:%s NULL
-10:20:10 %h:%i:%s.%f NULL
-10:20:10 %T NULL
-10:20:10AM %h:%i:%s%p NULL
-10:20:10AM %r NULL
-10:20:10.44AM %h:%i:%s.%f%p NULL
+10:20:10 %H:%i:%s 10:20:10
+10:20:10 %h:%i:%s.%f 10:20:10
+10:20:10 %T 10:20:10
+10:20:10AM %h:%i:%s%p 10:20:10
+10:20:10AM %r 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00
@@ -280,28 +285,23 @@ Tuesday 52 2001 %W %V %X 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00
-Warnings:
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000'
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
date format time2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
-10:20:10 %H:%i:%s NULL
-10:20:10 %h:%i:%s.%f NULL
-10:20:10 %T NULL
-10:20:10AM %h:%i:%s%p NULL
-10:20:10AM %r NULL
-10:20:10.44AM %h:%i:%s.%f%p NULL
+10:20:10 %H:%i:%s 10:20:10
+10:20:10 %h:%i:%s.%f 10:20:10
+10:20:10 %T 10:20:10
+10:20:10AM %h:%i:%s%p 10:20:10
+10:20:10AM %r 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00
@@ -318,13 +318,6 @@ Tuesday 52 2001 %W %V %X 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00
-Warnings:
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000'
select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'))
2003-01-02 08:11:02.123456
@@ -423,14 +416,14 @@ select date,format,str_to_date(date, format) as str_to_date from t1;
date format str_to_date
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
+03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
Warnings:
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
+03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
Warnings:
Warning 1292 Incorrect datetime value: '10:20:10AM'
drop table t1;
@@ -473,8 +466,6 @@ create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%
str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
-Warnings:
-Warning 1265 Data truncated for column 'f4' at row 1
describe t1;
Field Type Null Key Default Extra
f1 datetime YES NULL
@@ -484,7 +475,7 @@ f4 date YES NULL
f5 time YES NULL
select * from t1;
f1 f2 f3 f4 f5
-2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-00 58:00:00
+2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00
drop table t1;
create table t1 select "02 10" as a, "%d %H" as b;
select str_to_date(a,b) from t1;
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index a514ffcddd2..fb8dc9af71a 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -243,3 +243,15 @@ SET @@session.auto_increment_offset=
@bug20830_old_session_auto_increment_offset;
SET @@session.auto_increment_increment=
@bug20830_old_session_auto_increment_increment;
+CREATE TABLE t1(a BIT);
+INSERT DELAYED INTO t1 VALUES(1);
+FLUSH TABLE t1;
+SELECT HEX(a) FROM t1;
+HEX(a)
+1
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
+CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1);
+INSERT DELAYED INTO t2 VALUES(1);
+ERROR HY000: Table storage engine for 't2' doesn't have this option
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index ba4e9386312..4bdf1c770d3 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -214,3 +214,12 @@ select count(*) from t1;
count(*)
0
drop table t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+DELETE FROM t1 ORDER BY x;
+ERROR 42S22: Unknown column 'x' in 'order clause'
+DELETE FROM t1 ORDER BY t2.x;
+ERROR 42S22: Unknown column 't2.x' in 'order clause'
+DELETE FROM t1 ORDER BY (SELECT x);
+ERROR 42S22: Unknown column 'x' in 'field list'
+DROP TABLE t1;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 109ddcd02e1..20538694218 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -668,3 +668,17 @@ NULL
3
4
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES(1,1),(1,2),(1,3);
+SELECT DISTINCT a, b FROM t1;
+a b
+1 1
+1 2
+1 3
+SELECT DISTINCT a, a, b FROM t1;
+a a b
+1 1 1
+1 1 2
+1 1 3
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/endspace.result b/mysql-test/r/endspace.result
index 003ee7ffd5e..6fb33dee826 100644
--- a/mysql-test/r/endspace.result
+++ b/mysql-test/r/endspace.result
@@ -25,10 +25,11 @@ insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
-select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+select * from t1 ignore key (key1) where text1='teststring' or
+text1 like 'teststring_%' ORDER BY text1;
text1
-teststring
teststring
+teststring
select * from t1 where text1='teststring' or text1 like 'teststring_%';
text1
teststring
@@ -48,10 +49,11 @@ alter table t1 modify text1 char(32) binary not null;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
-select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+select * from t1 ignore key (key1) where text1='teststring' or
+text1 like 'teststring_%' ORDER BY text1;
text1
-teststring
teststring
+teststring
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
concat('|', text1, '|')
|teststring |
@@ -132,10 +134,11 @@ concat('|', text1, '|')
drop table t1;
create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap;
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
-select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+select * from t1 ignore key (key1) where text1='teststring' or
+text1 like 'teststring_%' ORDER BY text1;
text1
-teststring
teststring
+teststring
select * from t1 where text1='teststring' or text1 like 'teststring_%';
text1
teststring
diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result
index 0c84f24a2e4..94debb1785f 100644
--- a/mysql-test/r/errors.result
+++ b/mysql-test/r/errors.result
@@ -28,3 +28,16 @@ ERROR 42000: Display width out of range for column 'a' (max = 255)
set sql_mode='traditional';
create table t1 (a varchar(66000));
ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
+set sql_mode=default;
+CREATE TABLE t1 (a INT);
+SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
+a
+INSERT INTO t1 VALUES(1);
+SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
+a
+1
+INSERT INTO t1 VALUES(2),(3);
+SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
+a
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result
index af864c57efa..0b1cd67f559 100644
--- a/mysql-test/r/events.result
+++ b/mysql-test/r/events.result
@@ -1,4 +1,8 @@
-create database if not exists events_test;
+drop database if exists events_test;
+drop database if exists db_x;
+drop database if exists mysqltest_db2;
+drop database if exists mysqltest_no_such_database;
+create database events_test;
use events_test;
CREATE USER pauline@localhost;
CREATE DATABASE db_x;
@@ -73,7 +77,7 @@ 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
+ERROR HY000: Recursion 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;
@@ -118,82 +122,82 @@ 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
+Event sql_mode time_zone Create Event
+root6 SYSTEM CREATE EVENT `root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND STARTS '#' 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
+Event sql_mode time_zone Create Event
+root7 SYSTEM CREATE EVENT `root7` ON SCHEDULE EVERY 2 YEAR STARTS '#' 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
+Event sql_mode time_zone Create Event
+root8 SYSTEM CREATE EVENT `root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH STARTS '#' 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
+Event sql_mode time_zone Create Event
+root8_1 SYSTEM CREATE EVENT `root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH STARTS '#' 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
+Event sql_mode time_zone Create Event
+root9 SYSTEM CREATE EVENT `root9` ON SCHEDULE EVERY 2 WEEK STARTS '#' 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
+Event sql_mode time_zone Create Event
+root10 SYSTEM CREATE EVENT `root10` ON SCHEDULE EVERY '20 5' DAY_HOUR STARTS '#' 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
+Event sql_mode time_zone Create Event
+root11 SYSTEM CREATE EVENT `root11` ON SCHEDULE EVERY '21 1' DAY_HOUR STARTS '#' 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
+Event sql_mode time_zone Create Event
+root12 SYSTEM CREATE EVENT `root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE STARTS '#' 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
+Event sql_mode time_zone Create Event
+root13 SYSTEM CREATE EVENT `root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE STARTS '#' 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
+Event sql_mode time_zone Create Event
+root13_1 SYSTEM CREATE EVENT `root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE STARTS '#' 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
+Event sql_mode time_zone Create Event
+root14 SYSTEM CREATE EVENT `root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND STARTS '#' 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
+Event sql_mode time_zone Create Event
+root15 SYSTEM CREATE EVENT `root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND STARTS '#' 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
+Event sql_mode time_zone Create Event
+root16 SYSTEM CREATE EVENT `root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE STARTS '#' 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
+Event sql_mode time_zone Create Event
+root17 SYSTEM CREATE EVENT `root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE STARTS '#' 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
+Event sql_mode time_zone Create Event
+root17_1 SYSTEM CREATE EVENT `root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE STARTS '#' 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
+Event sql_mode time_zone Create Event
+root18 SYSTEM CREATE EVENT `root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND STARTS '#' 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
+Event sql_mode time_zone Create Event
+root19 SYSTEM CREATE EVENT `root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND STARTS '#' 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
+Event sql_mode time_zone Create Event
+root20 SYSTEM CREATE EVENT `root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND STARTS '#' 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");
+Event sql_mode time_zone Create Event
+ðóóò21 SYSTEM CREATE EVENT `ðóóò21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'òîâà å 1251 êîìåíòàð' DO select 1
+insert into mysql.event (db, name, body, definer, interval_value, interval_field, originator) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND", 1);
show create event root22;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SHOW EVENTS;
@@ -223,71 +227,180 @@ drop event root19;
drop event root20;
drop event ðóóò21;
set names latin1;
+Create a test event. Only event metadata is relevant,
+the actual schedule and body are not.
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;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
+Try to alter mysql.event: the server should fail to load
+event information after mysql.event was tampered with.
+
+First, let's add a column to the end and make sure everything
+works as before
+
+ALTER TABLE mysql.event ADD dummy INT;
SHOW EVENTS;
-ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 17. Table probably corrupted
-ALTER TABLE mysql.event DROP dummy2;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
+SELECT event_name FROM INFORMATION_SCHEMA.events;
+event_name
+intact_check
+SHOW CREATE EVENT intact_check;
+Event sql_mode time_zone Create Event
+intact_check SYSTEM CREATE EVENT `intact_check` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO SELECT "nothing"
+DROP EVENT no_such_event;
+ERROR HY000: Unknown event 'no_such_event'
+CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+ALTER EVENT intact_check_1 RENAME TO intact_check_2;
+DROP EVENT intact_check_1;
+ERROR HY000: Unknown event 'intact_check_1'
+DROP EVENT intact_check_2;
+DROP EVENT intact_check;
+DROP DATABASE IF EXISTS mysqltest_no_such_database;
+Warnings:
+Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
+CREATE DATABASE mysqltest_db2;
+DROP DATABASE mysqltest_db2;
+SELECT @@event_scheduler;
+@@event_scheduler
+OFF
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler OFF
+SET GLOBAL event_scheduler=OFF;
+ALTER TABLE mysql.event DROP dummy;
+CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
+
+Now let's add a column to the first position: the server
+expects to see event schema name there
+
+ALTER TABLE mysql.event ADD dummy INT FIRST;
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
+ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+SELECT event_name FROM INFORMATION_SCHEMA.events;
+ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+SHOW CREATE EVENT intact_check;
+ERROR HY000: Unknown event 'intact_check'
+DROP EVENT no_such_event;
+ERROR HY000: Unknown event 'no_such_event'
+CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+ERROR HY000: Unknown event 'intact_check_1'
+ALTER EVENT intact_check_1 RENAME TO intact_check_2;
+ERROR HY000: Unknown event 'intact_check_1'
+DROP EVENT intact_check_1;
+ERROR HY000: Unknown event 'intact_check_1'
+DROP EVENT intact_check_2;
+ERROR HY000: Unknown event 'intact_check_2'
+DROP EVENT intact_check;
+ERROR HY000: Unknown event 'intact_check'
+DROP DATABASE IF EXISTS mysqltest_no_such_database;
+Warnings:
+Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
+CREATE DATABASE mysqltest_db2;
+DROP DATABASE mysqltest_db2;
+SELECT @@event_scheduler;
+@@event_scheduler
+OFF
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler OFF
+SET GLOBAL event_scheduler=OFF;
+Clean up
+ALTER TABLE mysql.event DROP dummy;
+DELETE FROM mysql.event;
+CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
+Back up the table, further changes are not reversible
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.
+
+Drop some columns and try more checks.
+
+
ALTER TABLE mysql.event DROP comment, DROP starts;
+SHOW EVENTS;
+ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
-ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 14. Table probably corrupted
+ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+SHOW CREATE EVENT intact_check;
+ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+DROP EVENT no_such_event;
+ERROR HY000: Unknown event 'no_such_event'
+CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 16. The table is probably corrupted
+ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+ERROR HY000: Unknown event 'intact_check_1'
+ALTER EVENT intact_check_1 RENAME TO intact_check_2;
+ERROR HY000: Unknown event 'intact_check_1'
+DROP EVENT intact_check_1;
+ERROR HY000: Unknown event 'intact_check_1'
+DROP EVENT intact_check_2;
+ERROR HY000: Unknown event 'intact_check_2'
+DROP EVENT intact_check;
+DROP DATABASE IF EXISTS mysqltest_no_such_database;
+Warnings:
+Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
+CREATE DATABASE mysqltest_db2;
+DROP DATABASE mysqltest_db2;
+SELECT @@event_scheduler;
+@@event_scheduler
+OFF
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler OFF
+SET GLOBAL event_scheduler=OFF;
+
+Now drop the table, and test again
+
+
DROP TABLE mysql.event;
+SHOW EVENTS;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+SELECT event_name FROM INFORMATION_SCHEMA.events;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+SHOW CREATE EVENT intact_check;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+DROP EVENT no_such_event;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+ALTER EVENT intact_check_1 RENAME TO intact_check_2;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+DROP EVENT intact_check_1;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+DROP EVENT intact_check_2;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+DROP EVENT intact_check;
+ERROR 42S02: Table 'mysql.event' doesn't exist
+DROP DATABASE IF EXISTS mysqltest_no_such_database;
+Warnings:
+Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
+Error 1146 Table 'mysql.event' doesn't exist
+CREATE DATABASE mysqltest_db2;
+DROP DATABASE mysqltest_db2;
+OK, there is an unnecessary warning about the non-existent table
+but it's not easy to fix and no one complained about it.
+A similar warning is printed if mysql.proc is missing.
+SHOW WARNINGS;
+Level Code Message
+Error 1146 Table 'mysql.event' doesn't exist
+SELECT @@event_scheduler;
+@@event_scheduler
+OFF
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler OFF
+SET GLOBAL event_scheduler=OFF;
+Restore the original table.
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;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
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
@@ -366,7 +479,7 @@ 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
+ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present
drop table t_16;
create event white_space
on schedule every 10 hour
@@ -399,5 +512,197 @@ ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
SHOW EVENTS FROM ``;
ERROR 42000: Incorrect database name ''
SHOW EVENTS FROM `events\\test`;
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+
+LOCK TABLES mode.
+
+create table t1 (a int);
+create event e1 on schedule every 10 hour do select 1;
+lock table t1 read;
+show create event e1;
+Event sql_mode time_zone Create Event
+e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1
+select event_name from information_schema.events;
+event_name
+e1
+create event e2 on schedule every 10 hour do select 1;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+alter event e2 disable;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+alter event e2 rename to e3;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+drop event e2;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+drop event e1;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+unlock tables;
+lock table t1 write;
+show create event e1;
+Event sql_mode time_zone Create Event
+e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1
+select event_name from information_schema.events;
+event_name
+e1
+create event e2 on schedule every 10 hour do select 1;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+alter event e2 disable;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+alter event e2 rename to e3;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+drop event e2;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+drop event e1;
+ERROR HY000: Table 'event' was not locked with LOCK TABLES
+unlock tables;
+lock table t1 read, mysql.event read;
+show create event e1;
+Event sql_mode time_zone Create Event
+e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1
+select event_name from information_schema.events;
+event_name
+e1
+create event e2 on schedule every 10 hour do select 1;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+alter event e2 disable;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+alter event e2 rename to e3;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+drop event e2;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+drop event e1;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+unlock tables;
+lock table t1 write, mysql.event read;
+show create event e1;
+Event sql_mode time_zone Create Event
+e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1
+select event_name from information_schema.events;
+event_name
+e1
+create event e2 on schedule every 10 hour do select 1;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+alter event e2 disable;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+alter event e2 rename to e3;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+drop event e2;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+drop event e1;
+ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+unlock tables;
+lock table t1 read, mysql.event write;
+ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
+lock table t1 write, mysql.event write;
+ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
+lock table mysql.event write;
+show create event e1;
+Event sql_mode time_zone Create Event
+e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1
+select event_name from information_schema.events;
+event_name
+e1
+create event e2 on schedule every 10 hour do select 1;
+alter event e2 disable;
+alter event e2 rename to e3;
+drop event e3;
+drop event e1;
+unlock tables;
+Make sure we have left no events
+select event_name from information_schema.events;
+event_name
+
+Events in sub-statements, events and prelocking
+
+
+create event e1 on schedule every 10 hour do select 1;
+create function f1() returns int
+begin
+show create event e1;
+return 1;
+end|
+ERROR 0A000: Not allowed to return a result set from a function
+create trigger trg before insert on t1 for each row
+begin
+show create event e1;
+end|
+ERROR 0A000: Not allowed to return a result set from a trigger
+create function f1() returns int
+begin
+select event_name from information_schema.events;
+return 1;
+end|
+ERROR 0A000: Not allowed to return a result set from a function
+create trigger trg before insert on t1 for each row
+begin
+select event_name from information_schema.events;
+end|
+ERROR 0A000: Not allowed to return a result set from a trigger
+create function f1() returns int
+begin
+create event e2 on schedule every 10 hour do select 1;
+return 1;
+end|
+ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present
+create function f1() returns int
+begin
+alter event e1 rename to e2;
+return 1;
+end|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+create function f1() returns int
+begin
+drop event e2;
+return 1;
+end|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+----------------------------------------------------------------------
+create trigger trg before insert on t1 for each row
+begin
+set new.a= f1();
+end|
+create function f1() returns int
+begin
+call p1();
+return 0;
+end|
+create procedure p1()
+begin
+select event_name from information_schema.events;
+end|
+insert into t1 (a) values (1)|
+ERROR 0A000: Not allowed to return a result set from a trigger
+drop procedure p1|
+create procedure p1()
+begin
+show create event e1;
+end|
+insert into t1 (a) values (1)|
+ERROR 0A000: Not allowed to return a result set from a trigger
+drop procedure p1|
+create procedure p1()
+begin
+create temporary table tmp select event_name from information_schema.events;
+end|
+expected to work, since we redirect the output into a tmp table
+insert into t1 (a) values (1)|
+select * from tmp|
+event_name
+e1
+drop temporary table tmp|
+drop procedure p1|
+create procedure p1()
+begin
+alter event e1 rename to e2;
+end|
+insert into t1 (a) values (1)|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+drop procedure p1|
+create procedure p1()
+begin
+drop event e1;
+end|
+insert into t1 (a) values (1)|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or 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
index a7f0594588d..c4053bcfb47 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -1,4 +1,7 @@
-create database if not exists events_test;
+drop database if exists events_test;
+drop database if exists mysqltest_db1;
+drop database if exists mysqltest_db2;
+create database 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;
@@ -17,7 +20,7 @@ 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
+ERROR HY000: Recursion 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;
@@ -25,9 +28,12 @@ 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
+ERROR HY000: Incorrect AT value: '10000101000000'
create event e_55 on schedule at 20000101000000 do drop table t;
-ERROR HY000: Activation (AT) time is in the past
+Warnings:
+Note 1584 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created
+show events;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
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;
@@ -378,4 +384,149 @@ ERROR 42000: Access denied; you need the SUPER privilege for this operation
DROP EVENT e1;
ERROR HY000: Unknown event 'e1'
DROP USER mysqltest_u1@localhost;
+SET GLOBAL EVENT_SCHEDULER= OFF;
+SET @save_time_zone= @@TIME_ZONE;
+SET TIME_ZONE= '+00:00';
+SET TIMESTAMP= UNIX_TIMESTAMP('2005-12-31 23:58:59');
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
+SHOW EVENTS;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test e1 root@localhost +00:00 RECURRING NULL 1 DAY 2005-12-31 23:58:59 NULL ENABLED 1
+SET TIME_ZONE= '-01:00';
+ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:00';
+SHOW EVENTS;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test e1 root@localhost -01:00 RECURRING NULL 1 DAY 2000-01-01 00:00:00 NULL ENABLED 1
+SET TIME_ZONE= '+02:00';
+ALTER EVENT e1 ON SCHEDULE AT '2000-01-02 00:00:00'
+ ON COMPLETION PRESERVE DISABLE;
+SHOW EVENTS;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test e1 root@localhost +02:00 ONE TIME 2000-01-02 00:00:00 NULL NULL NULL NULL DISABLED 1
+SET TIME_ZONE= '-03:00';
+ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY ENDS '2030-01-03 00:00:00'
+ ON COMPLETION PRESERVE DISABLE;
+SHOW EVENTS;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 DISABLED 1
+SET TIME_ZONE= '+04:00';
+ALTER EVENT e1 DO SELECT 2;
+SHOW EVENTS;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 ENABLED 1
+DROP EVENT e1;
+SET TIME_ZONE='+05:00';
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
+SELECT 1;
+SET TIMESTAMP= @@TIMESTAMP + 1;
+SET TIME_ZONE='-05:00';
+CREATE EVENT e2 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
+SELECT 1;
+SET TIMESTAMP= @@TIMESTAMP + 1;
+SET TIME_ZONE='+00:00';
+CREATE EVENT e3 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
+SELECT 1;
+SELECT * FROM INFORMATION_SCHEMA.EVENTS ORDER BY event_name;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR
+NULL events_test e1 root@localhost +05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:58:59 2005-12-31 23:58:59 NULL 1
+NULL events_test e2 root@localhost -05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:00 2005-12-31 23:59:00 NULL 1
+NULL events_test e3 root@localhost +00:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:01 2005-12-31 23:59:01 NULL 1
+SHOW EVENTS;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1
+events_test e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1
+events_test e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1
+SHOW CREATE EVENT e1;
+Event sql_mode time_zone Create Event
+e1 +05:00 CREATE EVENT `e1` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1
+SHOW CREATE EVENT e2;
+Event sql_mode time_zone Create Event
+e2 -05:00 CREATE EVENT `e2` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1
+SHOW CREATE EVENT e3;
+Event sql_mode time_zone Create Event
+e3 +00:00 CREATE EVENT `e3` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1
+The following should fail, and nothing should be altered.
+ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00';
+ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been altered
+ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' DISABLE;
+ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been altered
+The following should give warnings, and nothing should be created.
+CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00'
+DO
+SELECT 1;
+Warnings:
+Note 1584 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created
+CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' DISABLE
+DO
+SELECT 1;
+Warnings:
+Note 1584 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created
+CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DO
+SELECT 1;
+Warnings:
+Note 1584 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created
+CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DISABLE
+DO
+SELECT 1;
+Warnings:
+Note 1584 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created
+SHOW EVENTS;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1
+events_test e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1
+events_test e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1
+The following should succeed giving a warning.
+ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE;
+Warnings:
+Note 1533 Event execution time is in the past. Event has been disabled
+CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE
+DO
+SELECT 1;
+Warnings:
+Note 1533 Event execution time is in the past. Event has been disabled
+CREATE EVENT e5 ON SCHEDULE AT '1999-01-01 00:00:00'
+ ON COMPLETION PRESERVE
+DO
+SELECT 1;
+Warnings:
+Note 1533 Event execution time is in the past. Event has been disabled
+The following should succeed without warnings.
+ALTER EVENT e2 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00';
+ALTER EVENT e3 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE;
+CREATE EVENT e6 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' DO
+SELECT 1;
+CREATE EVENT e7 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE
+DO
+SELECT 1;
+CREATE EVENT e8 ON SCHEDULE AT '1999-01-01 00:00:00'
+ ON COMPLETION PRESERVE DISABLE
+DO
+SELECT 1;
+SHOW EVENTS;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test e1 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1
+events_test e2 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED 1
+events_test e3 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1
+events_test e4 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1
+events_test e5 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED 1
+events_test e6 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED 1
+events_test e7 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1
+events_test e8 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED 1
+DROP EVENT e8;
+DROP EVENT e7;
+DROP EVENT e6;
+DROP EVENT e5;
+DROP EVENT e4;
+DROP EVENT e3;
+DROP EVENT e2;
+DROP EVENT e1;
+SET TIME_ZONE=@save_time_zone;
drop database events_test;
diff --git a/mysql-test/r/events_grant.result b/mysql-test/r/events_grant.result
index a28c30a9345..278cc5956f5 100644
--- a/mysql-test/r/events_grant.result
+++ b/mysql-test/r/events_grant.result
@@ -2,8 +2,8 @@ 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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
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
@@ -29,8 +29,8 @@ ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_te
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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
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
@@ -40,18 +40,18 @@ CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE CO
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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
+events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1
+events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1
"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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1
+events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1
"This should show us no events:";
SHOW EVENTS FROM test LIKE '%';
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
GRANT EVENT ON events_test2.* TO ev_test@localhost;
USE events_test2;
CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
diff --git a/mysql-test/r/events_logs_tests.result b/mysql-test/r/events_logs_tests.result
index ede7d0f4e25..0d49060f4a9 100644
--- a/mysql-test/r/events_logs_tests.result
+++ b/mysql-test/r/events_logs_tests.result
@@ -85,7 +85,7 @@ SELECT * FROM slow_event_test;
slo_val val
20 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"
+"Check slow log. Should see 1 row because 2 is over the threshold of 1 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)
diff --git a/mysql-test/r/events_restart_phase0.result b/mysql-test/r/events_restart_phase0.result
deleted file mode 100644
index 218b804a302..00000000000
--- a/mysql-test/r/events_restart_phase0.result
+++ /dev/null
@@ -1,22 +0,0 @@
-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
index a7a46fa0ab1..7b1de62f2ef 100644
--- a/mysql-test/r/events_restart_phase1.result
+++ b/mysql-test/r/events_restart_phase1.result
@@ -1,12 +1,16 @@
-create database if not exists mysqltest_events_test;
-use mysqltest_events_test;
set global event_scheduler=off;
+drop database if exists events_test;
+create database events_test;
+use events_test;
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');
+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');
+create table event_like like mysql.event;
+insert into event_like select * from mysql.event;
+alter table mysql.event
+change column body body longtext character set utf8 collate utf8_bin;
"Now we restart the server"
diff --git a/mysql-test/r/events_restart_phase2.result b/mysql-test/r/events_restart_phase2.result
index 703cb92324f..60ddf06bf23 100644
--- a/mysql-test/r/events_restart_phase2.result
+++ b/mysql-test/r/events_restart_phase2.result
@@ -1,6 +1,42 @@
-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"
+use events_test;
+select @@event_scheduler;
+@@event_scheduler
+DISABLED
+show events;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+select event_name from information_schema.events;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+show create event intact_check;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+drop event no_such_event;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+create event intact_check_1 on schedule every 5 hour do select 5;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+alter event intact_check_1 on schedule every 8 hour do select 8;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+alter event intact_check_1 rename to intact_check_2;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+drop event intact_check_1;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+drop event intact_check_2;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+drop event intact_check;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+set global event_scheduler=on;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+set global event_scheduler=off;
+ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
+show variables like 'event_scheduler';
+Variable_name Value
+event_scheduler DISABLED
+Make sure that we still can create and drop databases,
+and no warnings are produced.
+drop database if exists mysqltest_database_not_exists;
+Warnings:
+Note 1008 Can't drop database 'mysqltest_database_not_exists'; database doesn't exist
+create database mysqltest_db1;
+drop database mysqltest_db1;
+Restore the original mysql.event table
+drop table mysql.event;
+rename table event_like to mysql.event;
+Now let's restart the server again
diff --git a/mysql-test/r/events_restart_phase3.result b/mysql-test/r/events_restart_phase3.result
index e653d6a7c23..8ac00fdc70d 100644
--- a/mysql-test/r/events_restart_phase3.result
+++ b/mysql-test/r/events_restart_phase3.result
@@ -1,12 +1,12 @@
-use mysqltest_events_test;
+use events_test;
+select @@event_scheduler;
+@@event_scheduler
+ON
"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;
+drop database events_test;
diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result
index d885dc3a048..d45bffcd7ff 100644
--- a/mysql-test/r/events_scheduling.result
+++ b/mysql-test/r/events_scheduling.result
@@ -1,6 +1,8 @@
CREATE DATABASE IF NOT EXISTS events_test;
USE events_test;
SET GLOBAL event_scheduler=OFF;
+Try agian to make sure it's allowed
+SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE 'event_scheduler';
Variable_name Value
event_scheduler OFF
@@ -13,6 +15,8 @@ SHOW VARIABLES LIKE 'event_scheduler';
Variable_name Value
event_scheduler OFF
SET GLOBAL event_scheduler=ON;
+Try again to make sure it's allowed
+SET GLOBAL event_scheduler=ON;
SHOW VARIABLES LIKE 'event_scheduler';
Variable_name Value
event_scheduler ON
@@ -40,44 +44,56 @@ 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
+CREATE EVENT event_1 ON SCHEDULE EVERY 2 SECOND
+DO
+INSERT INTO table_1 VALUES (1);
+CREATE EVENT event_2 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);
+DO
+INSERT INTO table_2 VALUES (1);
+CREATE EVENT event_3 ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND
+ON COMPLETION NOT PRESERVE
+DO
+INSERT INTO table_3 VALUES (1);
+CREATE EVENT event_4 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')
+SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3;
+IF(SUM(a) >= 1, 'OK', 'ERROR')
OK
-SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_4;
-IF(SUM(a) > 0, 'OK', 'ERROR')
+SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_4;
+IF(SUM(a) >= 1, '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;
+SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR')
+FROM INFORMATION_SCHEMA.EVENTS
+WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2';
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;
+SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR')
+FROM INFORMATION_SCHEMA.EVENTS
+WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2';
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'
+DROP EVENT event_3;
+ERROR HY000: Unknown event 'event_3'
+DROP EVENT event_1;
"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;
+event_2 DISABLED
+event_4 DISABLED
+DROP EVENT event_2;
+DROP EVENT event_4;
DROP TABLE table_1;
DROP TABLE table_2;
DROP TABLE table_3;
diff --git a/mysql-test/r/events_time_zone.result b/mysql-test/r/events_time_zone.result
new file mode 100644
index 00000000000..b20aa445183
--- /dev/null
+++ b/mysql-test/r/events_time_zone.result
@@ -0,0 +1,149 @@
+DROP DATABASE IF EXISTS mysqltest_db1;
+CREATE DATABASE mysqltest_db1;
+USE mysqltest_db1;
+SET GLOBAL EVENT_SCHEDULER= OFF;
+SET @save_time_zone= @@TIME_ZONE;
+CREATE TABLE t_step (step INT);
+INSERT INTO t_step VALUES (@step);
+CREATE FUNCTION round_to_step(i INT, n INT) RETURNS INT
+BEGIN
+DECLARE step INT;
+SELECT * INTO step FROM t_step;
+# We add 0.1 as a protection from inexact division.
+RETURN FLOOR((i % (step * n) + 0.1) / step);
+END//
+SET @step3= @step * 3;
+SET @step6= @step * 6;
+SET @unix_time= @unix_time - @unix_time % @step6;
+INSERT INTO mysql.time_zone VALUES (NULL, 'N');
+SET @tzid= LAST_INSERT_ID();
+INSERT INTO mysql.time_zone_transition_type
+VALUES (@tzid, 0, 0, 0, 'b16420_0');
+INSERT INTO mysql.time_zone_transition_type
+VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
+INSERT INTO mysql.time_zone_name VALUES ('bug16420', @tzid);
+CREATE TABLE t1 (count INT, unix_time INT, local_time INT, comment CHAR(80));
+CREATE TABLE t2 (count INT);
+INSERT INTO t2 VALUES (1);
+CREATE FUNCTION f1(comment CHAR(80)) RETURNS INT
+BEGIN
+DECLARE orig_tz CHAR(64);
+DECLARE unix_time INT;
+DECLARE local_now DATETIME;
+DECLARE utc_now DATETIME;
+DECLARE local_time INT;
+SET unix_time= UNIX_TIMESTAMP();
+SET local_now= FROM_UNIXTIME(unix_time);
+SET orig_tz= @@TIME_ZONE;
+SET TIME_ZONE = '+00:00';
+SET utc_now= FROM_UNIXTIME(unix_time);
+SET TIME_ZONE= orig_tz;
+SET local_time = unix_time + TIMESTAMPDIFF(SECOND, utc_now, local_now);
+SET unix_time= round_to_step(unix_time, 6);
+SET local_time= round_to_step(local_time, 6);
+INSERT INTO t1 VALUES ((SELECT count FROM t2),
+unix_time, local_time, comment);
+RETURN 0;
+END//
+SET TIME_ZONE= '+00:00';
+CREATE EVENT e1 ON SCHEDULE EVERY @step SECOND
+STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e1>");
+SET TIME_ZONE= 'bug16420';
+CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
+STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e2>");
+SET GLOBAL EVENT_SCHEDULER= ON;
+SELECT SLEEP(@step / 2);
+SLEEP(@step / 2)
+0
+SET GLOBAL EVENT_SCHEDULER= OFF;
+SELECT * FROM t1 ORDER BY count, comment;
+count unix_time local_time comment
+1 1 1 <e1>
+1 1 3 <e2>
+1 1 3 e2 should be executed
+2 2 2 <e1>
+2 2 4 <e2>
+2 2 4 e2 should be executed
+3 3 3 <e1>
+3 3 3 Second pass after backward -2 step shift, e2 should not be executed
+4 4 4 <e1>
+4 4 4 Second pass after backward -2 step shift, e2 should not be executed
+5 5 5 <e1>
+5 5 5 <e2>
+5 5 5 e2 should be executed
+6 0 0 <e1>
+6 0 2 <e2>
+6 0 2 Forward +2 step shift, local 0, 1 are skipped, e2 should be executed
+7 1 1 <e1>
+7 1 3 <e2>
+7 1 3 e2 should be executed
+SET TIME_ZONE= @save_time_zone;
+DROP EVENT e2;
+DROP EVENT e1;
+DROP FUNCTION f1;
+DROP TABLE t1, t2;
+DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
+SET TIME_ZONE= '+00:00';
+CREATE TABLE t1 (event CHAR(2), dt DATE, offset INT);
+INSERT INTO mysql.time_zone VALUES (NULL, 'N');
+SET @tzid= LAST_INSERT_ID();
+SET @now= UNIX_TIMESTAMP();
+SET @offset_month_01= UNIX_TIMESTAMP('2030-01-31 12:00:00') - @now;
+SET @offset_month_02= UNIX_TIMESTAMP('2030-02-28 12:00:00') - @now - 5*@step;
+SET @offset_month_03= UNIX_TIMESTAMP('2030-03-31 12:00:00') - @now - 5*@step;
+SET @offset_month_04= UNIX_TIMESTAMP('2030-04-30 12:00:00') - @now - 13*@step;
+INSERT INTO mysql.time_zone_transition_type
+VALUES (@tzid, 0, @offset_month_01, 0, 'b16420_0');
+INSERT INTO mysql.time_zone_transition_type
+VALUES (@tzid, 1, @offset_month_02, 1, 'b16420_1');
+INSERT INTO mysql.time_zone_transition_type
+VALUES (@tzid, 2, @offset_month_03, 1, 'b16420_2');
+INSERT INTO mysql.time_zone_transition_type
+VALUES (@tzid, 3, @offset_month_04, 1, 'b16420_3');
+INSERT INTO mysql.time_zone_transition
+VALUES (@tzid, @now, 0);
+INSERT INTO mysql.time_zone_transition
+VALUES (@tzid, @now + 3 * @step, 1);
+INSERT INTO mysql.time_zone_transition
+VALUES (@tzid, @now + 7 * @step, 2);
+INSERT INTO mysql.time_zone_transition
+VALUES (@tzid, @now + 12 * @step, 3);
+INSERT INTO mysql.time_zone_name VALUES ('bug16420_2', @tzid);
+SET TIME_ZONE= 'bug16420_2';
+SET GLOBAL EVENT_SCHEDULER= ON;
+SET GLOBAL EVENT_SCHEDULER= OFF;
+Below we should see the following:
+- On Jan 31 only e2 is executed, because we started later than
+e1 should have been executed. Offset of e2 is 0 because of
+the late start, not 1.
+- The next execution is on Feb 28 (last day of Feb). Both events
+are executed in their times, offsets are -1 and 1.
+- The next time is Mar 31. Because the time of event
+execution was skipped over, events are executed right away,
+offsets are 2 and 2.
+- The next time is Apr 30. Events are again executed in their
+appointed times, offsets are -1 and 1.
+SELECT * FROM t1 ORDER BY dt, event;
+event dt offset
+e2 2030-01-31 0
+e1 2030-02-28 -1
+e2 2030-02-28 1
+e1 2030-03-31 2
+e2 2030-03-31 2
+e1 2030-04-30 -1
+e2 2030-04-30 1
+DROP EVENT e2;
+DROP EVENT e1;
+DROP TABLE t1;
+SET TIME_ZONE= @save_time_zone;
+DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
+DROP FUNCTION round_to_step;
+DROP TABLE t_step;
+DROP DATABASE mysqltest_db1;
+End of 5.1 tests.
diff --git a/mysql-test/r/events_trans.result b/mysql-test/r/events_trans.result
new file mode 100644
index 00000000000..a9829db0c61
--- /dev/null
+++ b/mysql-test/r/events_trans.result
@@ -0,0 +1,118 @@
+drop database if exists events_test;
+drop database if exists mysqltest_no_such_database;
+create database events_test;
+use events_test;
+
+Test that Events DDL issue an implicit COMMIT
+
+
+set autocommit=off;
+select @@autocommit;
+@@autocommit
+0
+create table t1 (a varchar(255)) engine=innodb;
+begin work;
+insert into t1 (a) values ("OK: create event");
+create event e1 on schedule every 1 day do select 1;
+rollback work;
+select * from t1;
+a
+OK: create event
+delete from t1;
+commit work;
+begin work;
+insert into t1 (a) values ("OK: alter event");
+alter event e1 on schedule every 2 day do select 2;
+rollback work;
+select * from t1;
+a
+OK: alter event
+delete from t1;
+commit work;
+begin work;
+insert into t1 (a) values ("OK: alter event rename");
+alter event e1 rename to e2;
+rollback work;
+select * from t1;
+a
+OK: alter event rename
+delete from t1;
+commit work;
+begin work;
+insert into t1 (a) values ("OK: drop event");
+drop event e2;
+rollback work;
+select * from t1;
+a
+OK: drop event
+delete from t1;
+commit work;
+begin work;
+insert into t1 (a) values ("OK: drop event if exists");
+drop event if exists e2;
+Warnings:
+Note 1305 Event e2 does not exist
+rollback work;
+select * from t1;
+a
+OK: drop event if exists
+delete from t1;
+commit work;
+create event e1 on schedule every 1 day do select 1;
+begin work;
+insert into t1 (a) values ("OK: create event if not exists");
+create event if not exists e1 on schedule every 2 day do select 2;
+Warnings:
+Note 1526 Event 'e1' already exists
+rollback work;
+select * from t1;
+a
+OK: create event if not exists
+delete from t1;
+commit work;
+
+Now check various error conditions: make sure we issue an
+implicit commit anyway
+
+begin work;
+insert into t1 (a) values ("OK: create event: event already exists");
+create event e1 on schedule every 2 day do select 2;
+ERROR HY000: Event 'e1' already exists
+rollback work;
+select * from t1;
+a
+OK: create event: event already exists
+delete from t1;
+commit work;
+begin work;
+insert into t1 (a) values ("OK: alter event rename: rename to same name");
+alter event e1 rename to e1;
+ERROR HY000: Same old and new event name
+rollback work;
+select * from t1;
+a
+OK: alter event rename: rename to same name
+delete from t1;
+commit work;
+create event e2 on schedule every 3 day do select 3;
+begin work;
+insert into t1 (a) values ("OK: alter event rename: destination exists");
+alter event e2 rename to e1;
+ERROR HY000: Event 'e1' already exists
+rollback work;
+select * from t1;
+a
+OK: alter event rename: destination exists
+delete from t1;
+commit work;
+begin work;
+insert into t1 (a) values ("OK: create event: database does not exist");
+create event mysqltest_no_such_database.e1 on schedule every 1 day do select 1;
+ERROR 42000: Unknown database 'mysqltest_no_such_database'
+rollback work;
+select * from t1;
+a
+OK: create event: database does not exist
+delete from t1;
+commit work;
+drop database events_test;
diff --git a/mysql-test/r/events_trans_notembedded.result b/mysql-test/r/events_trans_notembedded.result
new file mode 100644
index 00000000000..1e3dfffe232
--- /dev/null
+++ b/mysql-test/r/events_trans_notembedded.result
@@ -0,0 +1,45 @@
+drop database if exists events_test;
+drop database if exists mysqltest_db2;
+create database events_test;
+use events_test;
+grant create, insert, select, delete on mysqltest_db2.*
+to mysqltest_user1@localhost;
+create database mysqltest_db2;
+set autocommit=off;
+select @@autocommit;
+@@autocommit
+0
+create table t1 (a varchar(255)) engine=innodb;
+begin work;
+insert into t1 (a) values ("OK: create event: insufficient privileges");
+create event e1 on schedule every 1 day do select 1;
+ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db2'
+rollback work;
+select * from t1;
+a
+OK: create event: insufficient privileges
+delete from t1;
+commit work;
+begin work;
+insert into t1 (a) values ("OK: alter event: insufficient privileges");
+alter event e1 on schedule every 1 day do select 1;
+ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db2'
+rollback work;
+select * from t1;
+a
+OK: alter event: insufficient privileges
+delete from t1;
+commit work;
+begin work;
+insert into t1 (a) values ("OK: drop event: insufficient privileges");
+drop event e1;
+ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db2'
+rollback work;
+select * from t1;
+a
+OK: drop event: insufficient privileges
+delete from t1;
+commit work;
+drop user mysqltest_user1@localhost;
+drop database mysqltest_db2;
+drop database events_test;
diff --git a/mysql-test/r/federated_server.result b/mysql-test/r/federated_server.result
index 7a1a6e0970d..0905aabb075 100644
--- a/mysql-test/r/federated_server.result
+++ b/mysql-test/r/federated_server.result
@@ -20,6 +20,14 @@ CREATE TABLE first_db.t1 (
`name` varchar(64) NOT NULL default ''
)
DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS first_db.t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE first_db.t2 (
+`id` int(20) NOT NULL,
+`name` varchar(64) NOT NULL default ''
+ )
+DEFAULT CHARSET=latin1;
use second_db;
DROP TABLE IF EXISTS second_db.t1;
Warnings:
@@ -29,6 +37,14 @@ CREATE TABLE second_db.t1 (
`name` varchar(64) NOT NULL default ''
)
DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS second_db.t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE second_db.t2 (
+`id` int(20) NOT NULL,
+`name` varchar(64) NOT NULL default ''
+ )
+DEFAULT CHARSET=latin1;
drop server if exists 'server_one';
create server 'server_one' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
@@ -60,10 +76,10 @@ CREATE TABLE federated.old (
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/first_db/t1';
-INSERT INTO federated.old (id, name) values (1, 'federated.old url');
+INSERT INTO federated.old (id, name) values (1, 'federated.old-> first_db.t1, url format');
SELECT * FROM federated.old;
id name
-1 federated.old url
+1 federated.old-> first_db.t1, url format
DROP TABLE IF EXISTS federated.old2;
Warnings:
Note 1051 Unknown table 'old2'
@@ -72,8 +88,37 @@ CREATE TABLE federated.old2 (
`name` varchar(64) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/first_db/t2';
+INSERT INTO federated.old2 (id, name) values (1, 'federated.old2-> first_db.t2, url format');
+SELECT * FROM federated.old2;
+id name
+1 federated.old2-> first_db.t2, url format
+DROP TABLE IF EXISTS federated.urldb2t1;
+Warnings:
+Note 1051 Unknown table 'urldb2t1'
+CREATE TABLE federated.urldb2t1 (
+`id` int(20) NOT NULL,
+`name` varchar(64) NOT NULL default ''
+ )
+ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/second_db/t1';
-INSERT INTO federated.old2 (id, name) values (1, 'federated.old2 url');
+INSERT INTO federated.urldb2t1 (id, name) values (1, 'federated.urldb2t1 -> second_db.t1, url format');
+SELECT * FROM federated.urldb2t1;
+id name
+1 federated.urldb2t1 -> second_db.t1, url format
+DROP TABLE IF EXISTS federated.urldb2t2;
+Warnings:
+Note 1051 Unknown table 'urldb2t2'
+CREATE TABLE federated.urldb2t2 (
+`id` int(20) NOT NULL,
+`name` varchar(64) NOT NULL default ''
+ )
+ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/second_db/t2';
+INSERT INTO federated.urldb2t2 (id, name) values (1, 'federated.urldb2t2 -> second_db.t2, url format');
+SELECT * FROM federated.urldb2t2;
+id name
+1 federated.urldb2t2 -> second_db.t2, url format
DROP TABLE IF EXISTS federated.t1;
Warnings:
Note 1051 Unknown table 't1'
@@ -83,18 +128,38 @@ CREATE TABLE federated.t1 (
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='server_one';
-INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme');
+INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme, first_db.t1');
SELECT * FROM federated.t1;
id name
-1 federated.old url
-1 server_one, new scheme
+1 federated.old-> first_db.t1, url format
+1 server_one, new scheme, first_db.t1
+DROP TABLE IF EXISTS federated.whatever;
+Warnings:
+Note 1051 Unknown table 'whatever'
+CREATE TABLE federated.whatever (
+`id` int(20) NOT NULL,
+`name` varchar(64) NOT NULL default ''
+ )
+ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+CONNECTION='server_one/t1';
+INSERT INTO federated.whatever (id, name) values (1, 'server_one, new scheme, whatever, first_db.t1');
+SELECT * FROM federated.whatever;
+id name
+1 federated.old-> first_db.t1, url format
+1 server_one, new scheme, first_db.t1
+1 server_one, new scheme, whatever, first_db.t1
ALTER SERVER 'server_one' options(DATABASE 'second_db');
-flush tables;
-INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme');
+INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme, second_db.t1');
SELECT * FROM federated.t1;
id name
-1 federated.old2 url
-1 server_two, new scheme
+1 federated.urldb2t1 -> second_db.t1, url format
+1 server_two, new scheme, second_db.t1
+INSERT INTO federated.whatever (id, name) values (1, 'server_two, new scheme, whatever, second_db.t1');
+SELECT * FROM federated.whatever;
+id name
+1 federated.urldb2t1 -> second_db.t1, url format
+1 server_two, new scheme, second_db.t1
+1 server_two, new scheme, whatever, second_db.t1
drop table federated.t1;
drop server 'server_one';
drop server 'server_two';
@@ -104,6 +169,118 @@ drop table first_db.t1;
drop table second_db.t1;
drop database first_db;
drop database second_db;
+create database db_legitimate;
+create database db_bogus;
+use db_legitimate;
+CREATE TABLE db_legitimate.t1 (
+`id` int(20) NOT NULL,
+`name` varchar(64) NOT NULL default ''
+ );
+INSERT INTO db_legitimate.t1 VALUES ('1','this is legitimate');
+use db_bogus;
+CREATE TABLE db_bogus.t1 (
+`id` int(20) NOT NULL,
+`name` varchar(64) NOT NULL default ''
+ )
+;
+INSERT INTO db_bogus.t1 VALUES ('2','this is bogus');
+create server 's1' foreign data wrapper 'mysql' options
+(HOST '127.0.0.1',
+DATABASE 'db_legitimate',
+USER 'root',
+PASSWORD '',
+PORT SLAVE_PORT,
+SOCKET '',
+OWNER 'root');
+create user guest_select@localhost;
+grant select on federated.* to guest_select@localhost;
+create user guest_super@localhost;
+grant select,SUPER,RELOAD on *.* to guest_super@localhost;
+create user guest_usage@localhost;
+grant usage on *.* to guest_usage@localhost;
+CREATE TABLE federated.t1 (
+`id` int(20) NOT NULL,
+`name` varchar(64) NOT NULL default ''
+ ) ENGINE = FEDERATED CONNECTION = 's1';
+select * from federated.t1;
+id name
+1 this is legitimate
+alter server s1 options (database 'db_bogus');
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+flush tables;
+select * from federated.t1;
+id name
+1 this is legitimate
+alter server s1 options (database 'db_bogus');
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+flush tables;
+select * from federated.t1;
+id name
+1 this is legitimate
+alter server s1 options (database 'db_bogus');
+flush tables;
+select * from federated.t1;
+id name
+2 this is bogus
+drop server if exists 's1';
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+create server 's1' foreign data wrapper 'mysql' options
+(HOST '127.0.0.1',
+DATABASE 'db_legitimate',
+USER 'root',
+PASSWORD '',
+PORT SLAVE_PORT,
+SOCKET '',
+OWNER 'root');
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+drop server 's1';
+create server 's1' foreign data wrapper 'mysql' options
+(HOST '127.0.0.1',
+DATABASE 'db_legitimate',
+USER 'root',
+PASSWORD '',
+PORT SLAVE_PORT,
+SOCKET '',
+OWNER 'root');
+flush tables;
+select * from federated.t1;
+id name
+1 this is legitimate
+drop database db_legitimate;
+drop database db_bogus;
+drop user guest_super@localhost;
+drop user guest_usage@localhost;
+drop user guest_select@localhost;
+drop table federated.t1;
+drop server 's1';
+# End of 5.1 tests
+use test;
+create procedure p1 ()
+begin
+DECLARE v INT DEFAULT 0;
+DECLARE e INT DEFAULT 0;
+DECLARE i INT;
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET e = e + 1;
+SET i = sleep(5);
+WHILE v < 20000 do
+CREATE SERVER s
+FOREIGN DATA WRAPPER mysql
+OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test');
+ALTER SERVER s OPTIONS (USER 'Remote');
+DROP SERVER s;
+SET v = v + 1;
+END WHILE;
+SELECT e > 0;
+END//
+use test;
+call p1();
+call p1();
+e > 0
+1
+e > 0
+1
+drop procedure p1;
+drop server if exists s;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
diff --git a/mysql-test/r/flush2.result b/mysql-test/r/flush2.result
index 8257fa05b41..13bcc371ef6 100644
--- a/mysql-test/r/flush2.result
+++ b/mysql-test/r/flush2.result
@@ -1,26 +1,12 @@
flush logs;
set global expire_logs_days = 3;
-show variables like 'log%';
+show variables like 'log_bin%';
Variable_name Value
-log ON
log_bin OFF
log_bin_trust_function_creators ON
-log_error
-log_output TABLE
-log_queries_not_using_indexes OFF
-log_slave_updates OFF
-log_slow_queries OFF
-log_warnings 1
flush logs;
-show variables like 'log%';
+show variables like 'log_bin%';
Variable_name Value
-log ON
log_bin OFF
log_bin_trust_function_creators ON
-log_error
-log_output TABLE
-log_queries_not_using_indexes OFF
-log_slave_updates OFF
-log_slow_queries OFF
-log_warnings 1
set global expire_logs_days = 0;
diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result
index 1d045b21763..16fb143ee4c 100644
--- a/mysql-test/r/flush_block_commit_notembedded.result
+++ b/mysql-test/r/flush_block_commit_notembedded.result
@@ -5,11 +5,11 @@ insert t1 values (1);
flush tables with read lock;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 102
+master-bin.000001 106
commit;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 102
+master-bin.000001 106
unlock tables;
drop table t1;
set autocommit=1;
diff --git a/mysql-test/r/fulltext_left_join.result b/mysql-test/r/fulltext_left_join.result
index fdf11c14cc4..ea4cacf2fab 100644
--- a/mysql-test/r/fulltext_left_join.result
+++ b/mysql-test/r/fulltext_left_join.result
@@ -90,3 +90,10 @@ id link name relevance
1 1 string 0
2 0 string 0
DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, c TEXT, KEY(b));
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
+SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
+a b c
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 57b0a2aec25..4c7baac051a 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -734,3 +734,13 @@ f2 group_concat(f1)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2
drop table t1;
+CREATE TABLE t1(a TEXT, b CHAR(20));
+INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3");
+SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1;
+GROUP_CONCAT(DISTINCT UCASE(a))
+ONE.1,TWO.2,ONE.3
+SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1;
+GROUP_CONCAT(DISTINCT UCASE(b))
+ONE.1,TWO.2,ONE.3
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 972bb99d56f..7177028cb48 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1287,6 +1287,15 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
0.5 0.25
0.5000 0.2500
drop table bug22555;
+create table t1 (a decimal(20));
+insert into t1 values (12345678901234567890);
+select count(a) from t1;
+count(a)
+1
+select count(distinct a) from t1;
+count(distinct a)
+1
+drop table t1;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
INSERT INTO t1 SELECT a, b+8 FROM t1;
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 7a8f59c65f4..992d1cd418b 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -477,6 +477,11 @@ a
Warnings:
Warning 1292 Incorrect date value: '19772-07-29' for column 'a' at row 1
DROP TABLE t1,t2,t3,t4;
+CREATE TABLE t1 (id int not null);
+INSERT INTO t1 VALUES (1),(2);
+SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) );
+id
+DROP TABLE t1;
End of 5.0 tests
create table t1(f1 char(1));
insert into t1 values ('a'),('b'),('1');
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
index 124b20e9b46..b7dbfc670a8 100644
--- a/mysql-test/r/func_sapdb.result
+++ b/mysql-test/r/func_sapdb.result
@@ -75,6 +75,12 @@ NULL
select weekofyear("1997-11-30 23:59:59.000001");
weekofyear("1997-11-30 23:59:59.000001")
48
+select makedate(03,1);
+makedate(03,1)
+2003-01-01
+select makedate('0003',1);
+makedate('0003',1)
+2003-01-01
select makedate(1997,1);
makedate(1997,1)
1997-01-01
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 8bc613be4c0..283327430ba 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2297,6 +2297,15 @@ A B tire
0
# # 1
## ## 2
+SELECT REPEAT('0', CAST(0 AS UNSIGNED));
+REPEAT('0', CAST(0 AS UNSIGNED))
+
+SELECT REPEAT('0', -2);
+REPEAT('0', -2)
+
+SELECT REPEAT('0', 2);
+REPEAT('0', 2)
+00
DROP TABLE t1;
SELECT UNHEX('G');
UNHEX('G')
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 16a1e5d01d7..2d59a32218c 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1225,13 +1225,13 @@ TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s")
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
+0049-12-31 23:59:59
select date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND)
-NULL
+0198-12-31 23:59:59
select date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND);
date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND)
-NULL
+0200-01-01 00:00:01
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
@@ -1252,8 +1252,8 @@ 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
+0068-12-31 23:59:59
select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND)
-NULL
+0168-12-31 23:59:59
End of 5.1 tests
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index 138360edc49..a3955e8c008 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -10,7 +10,7 @@ t1 CREATE TABLE `t1` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
- SPATIAL KEY `g` (`g`(32))
+ SPATIAL KEY `g` (`g`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)'));
@@ -293,7 +293,7 @@ t2 CREATE TABLE `t2` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
- SPATIAL KEY `g` (`g`(32))
+ SPATIAL KEY `g` (`g`)
) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1
SELECT count(*) FROM t2;
count(*)
@@ -803,7 +803,7 @@ CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
-CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
@@ -820,7 +820,7 @@ test.t1 check status OK
drop table t1;
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
-SPATIAL KEY i1 (c1(32))
+SPATIAL KEY i1 (c1)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
@@ -836,7 +836,7 @@ test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
-SPATIAL KEY i1 (c1(32))
+SPATIAL KEY i1 (c1)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
@@ -873,6 +873,558 @@ SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
1
1
DROP TABLE t1;
+CREATE TABLE t1 (id bigint(12) unsigned NOT NULL auto_increment,
+c2 varchar(15) collate utf8_bin default NULL,
+c1 varchar(15) collate utf8_bin default NULL,
+c3 varchar(10) collate utf8_bin default NULL,
+spatial_point point NOT NULL,
+PRIMARY KEY(id),
+SPATIAL KEY (spatial_point)
+)ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+('y', 's', 'j', GeomFromText('POINT(167 74)')),
+('r', 'n', 'd', GeomFromText('POINT(215 118)')),
+('g', 'n', 'e', GeomFromText('POINT(203 98)')),
+('h', 'd', 'd', GeomFromText('POINT(54 193)')),
+('r', 'x', 'y', GeomFromText('POINT(47 69)')),
+('t', 'q', 'r', GeomFromText('POINT(109 42)')),
+('a', 'z', 'd', GeomFromText('POINT(0 154)')),
+('x', 'v', 'o', GeomFromText('POINT(174 131)')),
+('b', 'r', 'a', GeomFromText('POINT(114 253)')),
+('x', 'z', 'i', GeomFromText('POINT(163 21)')),
+('w', 'p', 'i', GeomFromText('POINT(42 102)')),
+('g', 'j', 'j', GeomFromText('POINT(170 133)')),
+('m', 'g', 'n', GeomFromText('POINT(28 22)')),
+('b', 'z', 'h', GeomFromText('POINT(174 28)')),
+('q', 'k', 'f', GeomFromText('POINT(233 73)')),
+('w', 'w', 'a', GeomFromText('POINT(124 200)')),
+('t', 'j', 'w', GeomFromText('POINT(252 101)')),
+('d', 'r', 'd', GeomFromText('POINT(98 18)')),
+('w', 'o', 'y', GeomFromText('POINT(165 31)')),
+('y', 'h', 't', GeomFromText('POINT(14 220)')),
+('d', 'p', 'u', GeomFromText('POINT(223 196)')),
+('g', 'y', 'g', GeomFromText('POINT(207 96)')),
+('x', 'm', 'n', GeomFromText('POINT(214 3)')),
+('g', 'v', 'e', GeomFromText('POINT(140 205)')),
+('g', 'm', 'm', GeomFromText('POINT(10 236)')),
+('i', 'r', 'j', GeomFromText('POINT(137 228)')),
+('w', 's', 'p', GeomFromText('POINT(115 6)')),
+('o', 'n', 'k', GeomFromText('POINT(158 129)')),
+('j', 'h', 'l', GeomFromText('POINT(129 72)')),
+('f', 'x', 'l', GeomFromText('POINT(139 207)')),
+('u', 'd', 'n', GeomFromText('POINT(125 109)')),
+('b', 'a', 'z', GeomFromText('POINT(30 32)')),
+('m', 'h', 'o', GeomFromText('POINT(251 251)')),
+('f', 'r', 'd', GeomFromText('POINT(243 211)')),
+('b', 'd', 'r', GeomFromText('POINT(232 80)')),
+('g', 'k', 'v', GeomFromText('POINT(15 100)')),
+('i', 'f', 'c', GeomFromText('POINT(109 66)')),
+('r', 't', 'j', GeomFromText('POINT(178 6)')),
+('y', 'n', 'f', GeomFromText('POINT(233 211)')),
+('f', 'y', 'm', GeomFromText('POINT(99 16)')),
+('z', 'q', 'l', GeomFromText('POINT(39 49)')),
+('j', 'c', 'r', GeomFromText('POINT(75 187)')),
+('c', 'y', 'y', GeomFromText('POINT(246 253)')),
+('w', 'u', 'd', GeomFromText('POINT(56 190)')),
+('n', 'q', 'm', GeomFromText('POINT(73 149)')),
+('d', 'y', 'a', GeomFromText('POINT(134 6)')),
+('z', 's', 'w', GeomFromText('POINT(216 225)')),
+('d', 'u', 'k', GeomFromText('POINT(132 70)')),
+('f', 'v', 't', GeomFromText('POINT(187 141)')),
+('r', 'r', 'a', GeomFromText('POINT(152 39)')),
+('y', 'p', 'o', GeomFromText('POINT(45 27)')),
+('p', 'n', 'm', GeomFromText('POINT(228 148)')),
+('e', 'g', 'e', GeomFromText('POINT(88 81)')),
+('m', 'a', 'h', GeomFromText('POINT(35 29)')),
+('m', 'h', 'f', GeomFromText('POINT(30 71)')),
+('h', 'k', 'i', GeomFromText('POINT(244 78)')),
+('z', 'v', 'd', GeomFromText('POINT(241 38)')),
+('q', 'l', 'j', GeomFromText('POINT(13 71)')),
+('s', 'p', 'g', GeomFromText('POINT(108 38)')),
+('q', 's', 'j', GeomFromText('POINT(92 101)')),
+('l', 'h', 'g', GeomFromText('POINT(120 78)')),
+('w', 't', 'b', GeomFromText('POINT(193 109)')),
+('b', 's', 's', GeomFromText('POINT(223 211)')),
+('w', 'w', 'y', GeomFromText('POINT(122 42)')),
+('q', 'c', 'c', GeomFromText('POINT(104 102)')),
+('w', 'g', 'n', GeomFromText('POINT(213 120)')),
+('p', 'q', 'a', GeomFromText('POINT(247 148)')),
+('c', 'z', 'e', GeomFromText('POINT(18 106)')),
+('z', 'u', 'n', GeomFromText('POINT(70 133)')),
+('j', 'n', 'x', GeomFromText('POINT(232 13)')),
+('e', 'h', 'f', GeomFromText('POINT(22 135)')),
+('w', 'l', 'f', GeomFromText('POINT(9 180)')),
+('a', 'v', 'q', GeomFromText('POINT(163 228)')),
+('i', 'z', 'o', GeomFromText('POINT(180 100)')),
+('e', 'c', 'l', GeomFromText('POINT(182 231)')),
+('c', 'k', 'o', GeomFromText('POINT(19 60)')),
+('q', 'f', 'p', GeomFromText('POINT(79 95)')),
+('m', 'd', 'r', GeomFromText('POINT(3 127)')),
+('m', 'e', 't', GeomFromText('POINT(136 154)')),
+('w', 'w', 'w', GeomFromText('POINT(102 15)')),
+('l', 'n', 'q', GeomFromText('POINT(71 196)')),
+('p', 'k', 'c', GeomFromText('POINT(47 139)')),
+('j', 'o', 'r', GeomFromText('POINT(177 128)')),
+('j', 'q', 'a', GeomFromText('POINT(170 6)')),
+('b', 'a', 'o', GeomFromText('POINT(63 211)')),
+('g', 's', 'o', GeomFromText('POINT(144 251)')),
+('w', 'u', 'w', GeomFromText('POINT(221 214)')),
+('g', 'a', 'm', GeomFromText('POINT(14 102)')),
+('u', 'q', 'z', GeomFromText('POINT(86 200)')),
+('k', 'a', 'm', GeomFromText('POINT(144 222)')),
+('j', 'u', 'r', GeomFromText('POINT(216 142)')),
+('q', 'k', 'v', GeomFromText('POINT(121 236)')),
+('p', 'o', 'r', GeomFromText('POINT(108 102)')),
+('b', 'd', 'x', GeomFromText('POINT(127 198)')),
+('k', 's', 'a', GeomFromText('POINT(2 150)')),
+('f', 'm', 'f', GeomFromText('POINT(160 191)')),
+('q', 'y', 'x', GeomFromText('POINT(98 111)')),
+('o', 'f', 'm', GeomFromText('POINT(232 218)')),
+('c', 'w', 'j', GeomFromText('POINT(156 165)')),
+('s', 'q', 'v', GeomFromText('POINT(98 161)'));
+SET @@RAND_SEED1=692635050, @@RAND_SEED2=297339954;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=159925977, @@RAND_SEED2=942570618;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=328169745, @@RAND_SEED2=410451954;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=178507359, @@RAND_SEED2=332493072;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=1034033013, @@RAND_SEED2=558966507;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+UPDATE t1 set spatial_point=GeomFromText('POINT(230 9)') where c1 like 'y%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(95 35)') where c1 like 'j%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(93 99)') where c1 like 'a%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(19 81)') where c1 like 'r%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(20 177)') where c1 like 'h%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(221 193)') where c1 like 'u%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(195 205)') where c1 like 'd%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(15 213)') where c1 like 'u%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(214 63)') where c1 like 'n%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(243 171)') where c1 like 'c%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(198 82)') where c1 like 'y%';
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+('f', 'y', 'p', GeomFromText('POINT(109 235)')),
+('b', 'e', 'v', GeomFromText('POINT(20 48)')),
+('i', 'u', 'f', GeomFromText('POINT(15 55)')),
+('o', 'r', 'z', GeomFromText('POINT(105 64)')),
+('a', 'p', 'a', GeomFromText('POINT(142 236)')),
+('g', 'i', 'k', GeomFromText('POINT(10 49)')),
+('x', 'z', 'x', GeomFromText('POINT(192 200)')),
+('c', 'v', 'r', GeomFromText('POINT(94 168)')),
+('y', 'z', 'e', GeomFromText('POINT(141 51)')),
+('h', 'm', 'd', GeomFromText('POINT(35 251)')),
+('v', 'm', 'q', GeomFromText('POINT(44 90)')),
+('j', 'l', 'z', GeomFromText('POINT(67 237)')),
+('i', 'v', 'a', GeomFromText('POINT(75 14)')),
+('b', 'q', 't', GeomFromText('POINT(153 33)')),
+('e', 'm', 'a', GeomFromText('POINT(247 49)')),
+('l', 'y', 'g', GeomFromText('POINT(56 203)')),
+('v', 'o', 'r', GeomFromText('POINT(90 54)')),
+('r', 'n', 'd', GeomFromText('POINT(135 83)')),
+('j', 't', 'u', GeomFromText('POINT(174 239)')),
+('u', 'n', 'g', GeomFromText('POINT(104 191)')),
+('p', 'q', 'y', GeomFromText('POINT(63 171)')),
+('o', 'q', 'p', GeomFromText('POINT(192 103)')),
+('f', 'x', 'e', GeomFromText('POINT(244 30)')),
+('n', 'x', 'c', GeomFromText('POINT(92 103)')),
+('r', 'q', 'z', GeomFromText('POINT(166 20)')),
+('s', 'a', 'j', GeomFromText('POINT(137 205)')),
+('z', 't', 't', GeomFromText('POINT(99 134)')),
+('o', 'm', 'j', GeomFromText('POINT(217 3)')),
+('n', 'h', 'j', GeomFromText('POINT(211 17)')),
+('v', 'v', 'a', GeomFromText('POINT(41 137)')),
+('q', 'o', 'j', GeomFromText('POINT(5 92)')),
+('z', 'y', 'e', GeomFromText('POINT(175 212)')),
+('j', 'z', 'h', GeomFromText('POINT(224 194)')),
+('a', 'g', 'm', GeomFromText('POINT(31 119)')),
+('p', 'c', 'f', GeomFromText('POINT(17 221)')),
+('t', 'h', 'k', GeomFromText('POINT(26 203)')),
+('u', 'w', 'p', GeomFromText('POINT(47 185)')),
+('z', 'a', 'c', GeomFromText('POINT(61 133)')),
+('u', 'k', 'a', GeomFromText('POINT(210 115)')),
+('k', 'f', 'h', GeomFromText('POINT(125 113)')),
+('t', 'v', 'y', GeomFromText('POINT(12 239)')),
+('u', 'v', 'd', GeomFromText('POINT(90 24)')),
+('m', 'y', 'w', GeomFromText('POINT(25 243)')),
+('d', 'n', 'g', GeomFromText('POINT(122 92)')),
+('z', 'm', 'f', GeomFromText('POINT(235 110)')),
+('q', 'd', 'f', GeomFromText('POINT(233 217)')),
+('a', 'v', 'u', GeomFromText('POINT(69 59)')),
+('x', 'k', 'p', GeomFromText('POINT(240 14)')),
+('i', 'v', 'r', GeomFromText('POINT(154 42)')),
+('w', 'h', 'l', GeomFromText('POINT(178 156)')),
+('d', 'h', 'n', GeomFromText('POINT(65 157)')),
+('c', 'k', 'z', GeomFromText('POINT(62 33)')),
+('e', 'l', 'w', GeomFromText('POINT(162 1)')),
+('r', 'f', 'i', GeomFromText('POINT(127 71)')),
+('q', 'm', 'c', GeomFromText('POINT(63 118)')),
+('c', 'h', 'u', GeomFromText('POINT(205 203)')),
+('d', 't', 'p', GeomFromText('POINT(234 87)')),
+('s', 'g', 'h', GeomFromText('POINT(149 34)')),
+('o', 'b', 'q', GeomFromText('POINT(159 179)')),
+('k', 'u', 'f', GeomFromText('POINT(202 254)')),
+('u', 'f', 'g', GeomFromText('POINT(70 15)')),
+('x', 's', 'b', GeomFromText('POINT(25 181)')),
+('s', 'c', 'g', GeomFromText('POINT(252 17)')),
+('a', 'c', 'f', GeomFromText('POINT(89 67)')),
+('r', 'e', 'q', GeomFromText('POINT(55 54)')),
+('f', 'i', 'k', GeomFromText('POINT(178 230)')),
+('p', 'e', 'l', GeomFromText('POINT(198 28)')),
+('w', 'o', 'd', GeomFromText('POINT(204 189)')),
+('c', 'a', 'g', GeomFromText('POINT(230 178)')),
+('r', 'o', 'e', GeomFromText('POINT(61 116)')),
+('w', 'a', 'a', GeomFromText('POINT(178 237)')),
+('v', 'd', 'e', GeomFromText('POINT(70 85)')),
+('k', 'c', 'e', GeomFromText('POINT(147 118)')),
+('d', 'q', 't', GeomFromText('POINT(218 77)')),
+('k', 'g', 'f', GeomFromText('POINT(192 113)')),
+('w', 'n', 'e', GeomFromText('POINT(92 124)')),
+('r', 'm', 'q', GeomFromText('POINT(130 65)')),
+('o', 'r', 'r', GeomFromText('POINT(174 233)')),
+('k', 'n', 't', GeomFromText('POINT(175 147)')),
+('q', 'm', 'r', GeomFromText('POINT(18 208)')),
+('l', 'd', 'i', GeomFromText('POINT(13 104)')),
+('w', 'o', 'y', GeomFromText('POINT(207 39)')),
+('p', 'u', 'o', GeomFromText('POINT(114 31)')),
+('y', 'a', 'p', GeomFromText('POINT(106 59)')),
+('a', 'x', 'z', GeomFromText('POINT(17 57)')),
+('v', 'h', 'x', GeomFromText('POINT(170 13)')),
+('t', 's', 'u', GeomFromText('POINT(84 18)')),
+('z', 'z', 'f', GeomFromText('POINT(250 197)')),
+('l', 'z', 't', GeomFromText('POINT(59 80)')),
+('j', 'g', 's', GeomFromText('POINT(54 26)')),
+('g', 'v', 'm', GeomFromText('POINT(89 98)')),
+('q', 'v', 'b', GeomFromText('POINT(39 240)')),
+('x', 'k', 'v', GeomFromText('POINT(246 207)')),
+('k', 'u', 'i', GeomFromText('POINT(105 111)')),
+('w', 'z', 's', GeomFromText('POINT(235 8)')),
+('d', 'd', 'd', GeomFromText('POINT(105 4)')),
+('c', 'z', 'q', GeomFromText('POINT(13 140)')),
+('m', 'k', 'i', GeomFromText('POINT(208 120)')),
+('g', 'a', 'g', GeomFromText('POINT(9 182)')),
+('z', 'j', 'r', GeomFromText('POINT(149 153)')),
+('h', 'f', 'g', GeomFromText('POINT(81 236)')),
+('m', 'e', 'q', GeomFromText('POINT(209 215)')),
+('c', 'h', 'y', GeomFromText('POINT(235 70)')),
+('i', 'e', 'g', GeomFromText('POINT(138 26)')),
+('m', 't', 'u', GeomFromText('POINT(119 237)')),
+('o', 'w', 's', GeomFromText('POINT(193 166)')),
+('f', 'm', 'q', GeomFromText('POINT(85 96)')),
+('x', 'l', 'x', GeomFromText('POINT(58 115)')),
+('x', 'q', 'u', GeomFromText('POINT(108 210)')),
+('b', 'h', 'i', GeomFromText('POINT(250 139)')),
+('y', 'd', 'x', GeomFromText('POINT(199 135)')),
+('w', 'h', 'p', GeomFromText('POINT(247 233)')),
+('p', 'z', 't', GeomFromText('POINT(148 249)')),
+('q', 'a', 'u', GeomFromText('POINT(174 78)')),
+('v', 't', 'm', GeomFromText('POINT(70 228)')),
+('t', 'n', 'f', GeomFromText('POINT(123 2)')),
+('x', 't', 'b', GeomFromText('POINT(35 50)')),
+('r', 'j', 'f', GeomFromText('POINT(200 51)')),
+('s', 'q', 'o', GeomFromText('POINT(23 184)')),
+('u', 'v', 'z', GeomFromText('POINT(7 113)')),
+('v', 'u', 'l', GeomFromText('POINT(145 190)')),
+('o', 'k', 'i', GeomFromText('POINT(161 122)')),
+('l', 'y', 'e', GeomFromText('POINT(17 232)')),
+('t', 'b', 'e', GeomFromText('POINT(120 50)')),
+('e', 's', 'u', GeomFromText('POINT(254 1)')),
+('d', 'd', 'u', GeomFromText('POINT(167 140)')),
+('o', 'b', 'x', GeomFromText('POINT(186 237)')),
+('m', 's', 's', GeomFromText('POINT(172 149)')),
+('t', 'y', 'a', GeomFromText('POINT(149 85)')),
+('x', 't', 'r', GeomFromText('POINT(10 165)')),
+('g', 'c', 'e', GeomFromText('POINT(95 165)')),
+('e', 'e', 'z', GeomFromText('POINT(98 65)')),
+('f', 'v', 'i', GeomFromText('POINT(149 144)')),
+('o', 'p', 'm', GeomFromText('POINT(233 67)')),
+('t', 'u', 'b', GeomFromText('POINT(109 215)')),
+('o', 'o', 'b', GeomFromText('POINT(130 48)')),
+('e', 'm', 'h', GeomFromText('POINT(88 189)')),
+('e', 'v', 'y', GeomFromText('POINT(55 29)')),
+('e', 't', 'm', GeomFromText('POINT(129 55)')),
+('p', 'p', 'i', GeomFromText('POINT(126 222)')),
+('c', 'i', 'c', GeomFromText('POINT(19 158)')),
+('c', 'b', 's', GeomFromText('POINT(13 19)')),
+('u', 'y', 'a', GeomFromText('POINT(114 5)')),
+('a', 'o', 'f', GeomFromText('POINT(227 232)')),
+('t', 'c', 'z', GeomFromText('POINT(63 62)')),
+('d', 'o', 'k', GeomFromText('POINT(48 228)')),
+('x', 'c', 'e', GeomFromText('POINT(204 2)')),
+('e', 'e', 'g', GeomFromText('POINT(125 43)')),
+('o', 'r', 'f', GeomFromText('POINT(171 140)'));
+UPDATE t1 set spatial_point=GeomFromText('POINT(163 157)') where c1 like 'w%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(53 151)') where c1 like 'd%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(96 183)') where c1 like 'r%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(57 91)') where c1 like 'q%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(202 110)') where c1 like 'c%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(120 137)') where c1 like 'w%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(207 147)') where c1 like 'c%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(31 125)') where c1 like 'e%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(27 36)') where c1 like 'r%';
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+('b', 'c', 'e', GeomFromText('POINT(41 137)')),
+('p', 'y', 'k', GeomFromText('POINT(50 22)')),
+('s', 'c', 'h', GeomFromText('POINT(208 173)')),
+('x', 'u', 'l', GeomFromText('POINT(199 175)')),
+('s', 'r', 'h', GeomFromText('POINT(85 192)')),
+('j', 'k', 'u', GeomFromText('POINT(18 25)')),
+('p', 'w', 'h', GeomFromText('POINT(152 197)')),
+('e', 'd', 'c', GeomFromText('POINT(229 3)')),
+('o', 'x', 'k', GeomFromText('POINT(187 155)')),
+('o', 'b', 'k', GeomFromText('POINT(208 150)')),
+('d', 'a', 'j', GeomFromText('POINT(70 87)')),
+('f', 'e', 'k', GeomFromText('POINT(156 96)')),
+('u', 'y', 'p', GeomFromText('POINT(239 193)')),
+('n', 'v', 'p', GeomFromText('POINT(223 98)')),
+('z', 'j', 'r', GeomFromText('POINT(87 89)')),
+('h', 'x', 'x', GeomFromText('POINT(92 0)')),
+('r', 'v', 'r', GeomFromText('POINT(159 139)')),
+('v', 'g', 'g', GeomFromText('POINT(16 229)')),
+('z', 'k', 'u', GeomFromText('POINT(99 52)')),
+('p', 'p', 'o', GeomFromText('POINT(105 125)')),
+('w', 'h', 'y', GeomFromText('POINT(105 154)')),
+('v', 'y', 'z', GeomFromText('POINT(134 238)')),
+('x', 'o', 'o', GeomFromText('POINT(178 88)')),
+('z', 'w', 'd', GeomFromText('POINT(123 60)')),
+('q', 'f', 'u', GeomFromText('POINT(64 90)')),
+('s', 'n', 't', GeomFromText('POINT(50 138)')),
+('v', 'p', 't', GeomFromText('POINT(114 91)')),
+('a', 'o', 'n', GeomFromText('POINT(78 43)')),
+('k', 'u', 'd', GeomFromText('POINT(185 161)')),
+('w', 'd', 'n', GeomFromText('POINT(25 92)')),
+('k', 'w', 'a', GeomFromText('POINT(59 238)')),
+('t', 'c', 'f', GeomFromText('POINT(65 87)')),
+('g', 's', 'p', GeomFromText('POINT(238 126)')),
+('d', 'n', 'y', GeomFromText('POINT(107 173)')),
+('l', 'a', 'w', GeomFromText('POINT(125 152)')),
+('m', 'd', 'j', GeomFromText('POINT(146 53)')),
+('q', 'm', 'c', GeomFromText('POINT(217 187)')),
+('i', 'r', 'r', GeomFromText('POINT(6 113)')),
+('e', 'j', 'b', GeomFromText('POINT(37 83)')),
+('w', 'w', 'h', GeomFromText('POINT(83 199)')),
+('k', 'b', 's', GeomFromText('POINT(170 64)')),
+('s', 'b', 'c', GeomFromText('POINT(163 130)')),
+('c', 'h', 'a', GeomFromText('POINT(141 3)')),
+('k', 'j', 'u', GeomFromText('POINT(143 76)')),
+('r', 'h', 'o', GeomFromText('POINT(243 92)')),
+('i', 'd', 'b', GeomFromText('POINT(205 13)')),
+('r', 'y', 'q', GeomFromText('POINT(138 8)')),
+('m', 'o', 'i', GeomFromText('POINT(36 45)')),
+('v', 'g', 'm', GeomFromText('POINT(0 40)')),
+('f', 'e', 'i', GeomFromText('POINT(76 6)')),
+('c', 'q', 'q', GeomFromText('POINT(115 248)')),
+('x', 'c', 'i', GeomFromText('POINT(29 74)')),
+('l', 's', 't', GeomFromText('POINT(83 18)')),
+('t', 't', 'a', GeomFromText('POINT(26 168)')),
+('u', 'n', 'x', GeomFromText('POINT(200 110)')),
+('j', 'b', 'd', GeomFromText('POINT(216 136)')),
+('s', 'p', 'w', GeomFromText('POINT(38 156)')),
+('f', 'b', 'v', GeomFromText('POINT(29 186)')),
+('v', 'e', 'r', GeomFromText('POINT(149 40)')),
+('v', 't', 'm', GeomFromText('POINT(184 24)')),
+('y', 'g', 'a', GeomFromText('POINT(219 105)')),
+('s', 'f', 'i', GeomFromText('POINT(114 130)')),
+('e', 'q', 'h', GeomFromText('POINT(203 135)')),
+('h', 'g', 'b', GeomFromText('POINT(9 208)')),
+('o', 'l', 'r', GeomFromText('POINT(245 79)')),
+('s', 's', 'v', GeomFromText('POINT(238 198)')),
+('w', 'w', 'z', GeomFromText('POINT(209 232)')),
+('v', 'd', 'n', GeomFromText('POINT(30 193)')),
+('q', 'w', 'k', GeomFromText('POINT(133 18)')),
+('o', 'h', 'o', GeomFromText('POINT(42 140)')),
+('f', 'f', 'h', GeomFromText('POINT(145 1)')),
+('u', 's', 'r', GeomFromText('POINT(70 62)')),
+('x', 'n', 'q', GeomFromText('POINT(33 86)')),
+('u', 'p', 'v', GeomFromText('POINT(232 220)')),
+('z', 'e', 'a', GeomFromText('POINT(130 69)')),
+('r', 'u', 'z', GeomFromText('POINT(243 241)')),
+('b', 'n', 't', GeomFromText('POINT(120 12)')),
+('u', 'f', 's', GeomFromText('POINT(190 212)')),
+('a', 'd', 'q', GeomFromText('POINT(235 191)')),
+('f', 'q', 'm', GeomFromText('POINT(176 2)')),
+('n', 'c', 's', GeomFromText('POINT(218 163)')),
+('e', 'm', 'h', GeomFromText('POINT(163 108)')),
+('c', 'f', 'l', GeomFromText('POINT(220 115)')),
+('c', 'v', 'q', GeomFromText('POINT(66 45)')),
+('w', 'v', 'x', GeomFromText('POINT(251 220)')),
+('f', 'w', 'z', GeomFromText('POINT(146 149)')),
+('h', 'n', 'h', GeomFromText('POINT(148 128)')),
+('y', 'k', 'v', GeomFromText('POINT(28 110)')),
+('c', 'x', 'q', GeomFromText('POINT(13 13)')),
+('e', 'd', 's', GeomFromText('POINT(91 190)')),
+('c', 'w', 'c', GeomFromText('POINT(10 231)')),
+('u', 'j', 'n', GeomFromText('POINT(250 21)')),
+('w', 'n', 'x', GeomFromText('POINT(141 69)')),
+('f', 'p', 'y', GeomFromText('POINT(228 246)')),
+('d', 'q', 'f', GeomFromText('POINT(194 22)')),
+('d', 'z', 'l', GeomFromText('POINT(233 181)')),
+('c', 'a', 'q', GeomFromText('POINT(183 96)')),
+('m', 'i', 'd', GeomFromText('POINT(117 226)')),
+('z', 'y', 'y', GeomFromText('POINT(62 81)')),
+('g', 'v', 'm', GeomFromText('POINT(66 158)'));
+SET @@RAND_SEED1=481064922, @@RAND_SEED2=438133497;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=280535103, @@RAND_SEED2=444518646;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=1072017234, @@RAND_SEED2=484203885;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=358851897, @@RAND_SEED2=358495224;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=509031459, @@RAND_SEED2=675962925;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+UPDATE t1 set spatial_point=GeomFromText('POINT(61 203)') where c1 like 'y%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(202 194)') where c1 like 'f%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(228 18)') where c1 like 'h%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(88 18)') where c1 like 'l%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(176 94)') where c1 like 'e%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(44 47)') where c1 like 'g%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(95 191)') where c1 like 'b%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(179 218)') where c1 like 'y%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(239 40)') where c1 like 'g%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(248 41)') where c1 like 'q%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(167 82)') where c1 like 't%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(13 104)') where c1 like 'u%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(139 84)') where c1 like 'a%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(145 108)') where c1 like 'p%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(147 57)') where c1 like 't%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(217 144)') where c1 like 'n%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(160 224)') where c1 like 'w%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(38 28)') where c1 like 'j%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(104 114)') where c1 like 'q%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(88 19)') where c1 like 'c%';
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+('f', 'x', 'p', GeomFromText('POINT(92 181)')),
+('s', 'i', 'c', GeomFromText('POINT(49 60)')),
+('c', 'c', 'i', GeomFromText('POINT(7 57)')),
+('n', 'g', 'k', GeomFromText('POINT(252 105)')),
+('g', 'b', 'm', GeomFromText('POINT(180 11)')),
+('u', 'l', 'r', GeomFromText('POINT(32 90)')),
+('c', 'x', 'e', GeomFromText('POINT(143 24)')),
+('x', 'u', 'a', GeomFromText('POINT(123 92)')),
+('s', 'b', 'h', GeomFromText('POINT(190 108)')),
+('c', 'x', 'b', GeomFromText('POINT(104 100)')),
+('i', 'd', 't', GeomFromText('POINT(214 104)')),
+('r', 'w', 'g', GeomFromText('POINT(29 67)')),
+('b', 'f', 'g', GeomFromText('POINT(149 46)')),
+('r', 'r', 'd', GeomFromText('POINT(242 196)')),
+('j', 'l', 'a', GeomFromText('POINT(90 196)')),
+('e', 't', 'b', GeomFromText('POINT(190 64)')),
+('l', 'x', 'w', GeomFromText('POINT(250 73)')),
+('q', 'y', 'r', GeomFromText('POINT(120 182)')),
+('s', 'j', 'a', GeomFromText('POINT(180 175)')),
+('n', 'i', 'y', GeomFromText('POINT(124 136)')),
+('s', 'x', 's', GeomFromText('POINT(176 209)')),
+('u', 'f', 's', GeomFromText('POINT(215 173)')),
+('m', 'j', 'x', GeomFromText('POINT(44 140)')),
+('v', 'g', 'x', GeomFromText('POINT(177 233)')),
+('u', 't', 'b', GeomFromText('POINT(136 197)')),
+('f', 'g', 'b', GeomFromText('POINT(10 8)')),
+('v', 'c', 'j', GeomFromText('POINT(13 81)')),
+('d', 's', 'q', GeomFromText('POINT(200 100)')),
+('a', 'p', 'j', GeomFromText('POINT(33 40)')),
+('i', 'c', 'g', GeomFromText('POINT(168 204)')),
+('k', 'h', 'i', GeomFromText('POINT(93 243)')),
+('s', 'b', 's', GeomFromText('POINT(157 13)')),
+('v', 'l', 'l', GeomFromText('POINT(103 6)')),
+('r', 'b', 'k', GeomFromText('POINT(244 137)')),
+('l', 'd', 'r', GeomFromText('POINT(162 254)')),
+('q', 'b', 'z', GeomFromText('POINT(136 246)')),
+('x', 'x', 'p', GeomFromText('POINT(120 37)')),
+('m', 'e', 'z', GeomFromText('POINT(203 167)')),
+('q', 'n', 'p', GeomFromText('POINT(94 119)')),
+('b', 'g', 'u', GeomFromText('POINT(93 248)')),
+('r', 'v', 'v', GeomFromText('POINT(53 88)')),
+('y', 'a', 'i', GeomFromText('POINT(98 219)')),
+('a', 's', 'g', GeomFromText('POINT(173 138)')),
+('c', 'a', 't', GeomFromText('POINT(235 135)')),
+('q', 'm', 'd', GeomFromText('POINT(224 208)')),
+('e', 'p', 'k', GeomFromText('POINT(161 238)')),
+('n', 'g', 'q', GeomFromText('POINT(35 204)')),
+('t', 't', 'x', GeomFromText('POINT(230 178)')),
+('w', 'f', 'a', GeomFromText('POINT(150 221)')),
+('z', 'm', 'z', GeomFromText('POINT(119 42)')),
+('l', 'j', 's', GeomFromText('POINT(97 96)')),
+('f', 'z', 'x', GeomFromText('POINT(208 65)')),
+('i', 'v', 'c', GeomFromText('POINT(145 79)')),
+('l', 'f', 'k', GeomFromText('POINT(83 234)')),
+('u', 'a', 's', GeomFromText('POINT(250 49)')),
+('o', 'k', 'p', GeomFromText('POINT(46 50)')),
+('d', 'e', 'z', GeomFromText('POINT(30 198)')),
+('r', 'r', 'l', GeomFromText('POINT(78 189)')),
+('y', 'l', 'f', GeomFromText('POINT(188 132)')),
+('d', 'q', 'm', GeomFromText('POINT(247 107)')),
+('p', 'j', 'n', GeomFromText('POINT(148 227)')),
+('b', 'o', 'i', GeomFromText('POINT(172 25)')),
+('e', 'v', 'd', GeomFromText('POINT(94 248)')),
+('q', 'd', 'f', GeomFromText('POINT(15 29)')),
+('w', 'b', 'b', GeomFromText('POINT(74 111)')),
+('g', 'q', 'f', GeomFromText('POINT(107 215)')),
+('o', 'h', 'r', GeomFromText('POINT(25 168)')),
+('u', 't', 'w', GeomFromText('POINT(251 188)')),
+('h', 's', 'w', GeomFromText('POINT(254 247)')),
+('f', 'f', 'b', GeomFromText('POINT(166 103)'));
+SET @@RAND_SEED1=866613816, @@RAND_SEED2=92289615;
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+('l', 'c', 'l', GeomFromText('POINT(202 98)')),
+('k', 'c', 'b', GeomFromText('POINT(46 206)')),
+('r', 'y', 'm', GeomFromText('POINT(74 140)')),
+('y', 'z', 'd', GeomFromText('POINT(200 160)')),
+('s', 'y', 's', GeomFromText('POINT(156 205)')),
+('u', 'v', 'p', GeomFromText('POINT(86 82)')),
+('j', 's', 's', GeomFromText('POINT(91 233)')),
+('x', 'j', 'f', GeomFromText('POINT(3 14)')),
+('l', 'z', 'v', GeomFromText('POINT(123 156)')),
+('h', 'i', 'o', GeomFromText('POINT(145 229)')),
+('o', 'r', 'd', GeomFromText('POINT(15 22)')),
+('f', 'x', 't', GeomFromText('POINT(21 60)')),
+('t', 'g', 'h', GeomFromText('POINT(50 153)')),
+('g', 'u', 'b', GeomFromText('POINT(82 85)')),
+('v', 'a', 'p', GeomFromText('POINT(231 178)')),
+('n', 'v', 'o', GeomFromText('POINT(183 25)')),
+('j', 'n', 'm', GeomFromText('POINT(50 144)')),
+('e', 'f', 'i', GeomFromText('POINT(46 16)')),
+('d', 'w', 'a', GeomFromText('POINT(66 6)')),
+('f', 'x', 'a', GeomFromText('POINT(107 197)')),
+('m', 'o', 'a', GeomFromText('POINT(142 80)')),
+('q', 'l', 'g', GeomFromText('POINT(251 23)')),
+('c', 's', 's', GeomFromText('POINT(158 43)')),
+('y', 'd', 'o', GeomFromText('POINT(196 228)')),
+('d', 'p', 'l', GeomFromText('POINT(107 5)')),
+('h', 'a', 'b', GeomFromText('POINT(183 166)')),
+('m', 'w', 'p', GeomFromText('POINT(19 59)')),
+('b', 'y', 'o', GeomFromText('POINT(178 30)')),
+('x', 'w', 'i', GeomFromText('POINT(168 94)')),
+('t', 'k', 'z', GeomFromText('POINT(171 5)')),
+('r', 'm', 'a', GeomFromText('POINT(222 19)')),
+('u', 'v', 'e', GeomFromText('POINT(224 80)')),
+('q', 'r', 'k', GeomFromText('POINT(212 218)')),
+('d', 'p', 'j', GeomFromText('POINT(169 7)')),
+('d', 'r', 'v', GeomFromText('POINT(193 23)')),
+('n', 'y', 'y', GeomFromText('POINT(130 178)')),
+('m', 'z', 'r', GeomFromText('POINT(81 200)')),
+('j', 'e', 'w', GeomFromText('POINT(145 239)')),
+('v', 'h', 'x', GeomFromText('POINT(24 105)')),
+('z', 'm', 'a', GeomFromText('POINT(175 129)')),
+('b', 'c', 'v', GeomFromText('POINT(213 10)')),
+('t', 't', 'u', GeomFromText('POINT(2 129)')),
+('r', 's', 'v', GeomFromText('POINT(209 192)')),
+('x', 'p', 'g', GeomFromText('POINT(43 63)')),
+('t', 'e', 'u', GeomFromText('POINT(139 210)')),
+('l', 'e', 't', GeomFromText('POINT(245 148)')),
+('a', 'i', 'k', GeomFromText('POINT(167 195)')),
+('m', 'o', 'h', GeomFromText('POINT(206 120)')),
+('g', 'z', 's', GeomFromText('POINT(169 240)')),
+('z', 'u', 's', GeomFromText('POINT(202 120)')),
+('i', 'b', 'a', GeomFromText('POINT(216 18)')),
+('w', 'y', 'g', GeomFromText('POINT(119 236)')),
+('h', 'y', 'p', GeomFromText('POINT(161 24)'));
+UPDATE t1 set spatial_point=GeomFromText('POINT(33 100)') where c1 like 't%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%';
+CHECK TABLE t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
INSERT INTO t1(foo) VALUES (NULL);
ERROR 23000: Column 'foo' cannot be null
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 8f81c7c4b66..cfca4e318c0 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -385,7 +385,7 @@ 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
+120 121 0 0 1 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,
@@ -730,6 +730,12 @@ point(b, b) IS NULL linestring(b) IS NULL polygon(b) IS NULL multipoint(b) IS NU
1 1 1 1 1 1 1
0 1 1 1 1 1 1
drop table t1;
+CREATE TABLE t1(a POINT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+a
+NULL
+DROP TABLE t1;
End of 4.1 tests
create table t1 (s1 geometry not null,s2 char(100));
create trigger t1_bu before update on t1 for each row set new.s1 = null;
@@ -764,6 +770,102 @@ create table t1 (g geometry not null);
insert into t1 values(default);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
+CREATE TABLE t1 (a GEOMETRY);
+CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
+CREATE VIEW v2 AS SELECT a FROM t1;
+DESCRIBE v1;
+Field Type Null Key Default Extra
+GeomFromwkb(ASBINARY(a)) geometry YES NULL
+DESCRIBE v2;
+Field Type Null Key Default Extra
+a geometry YES NULL
+DROP VIEW v1,v2;
+DROP TABLE t1;
+create table t1 (name VARCHAR(100), square GEOMETRY);
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
desc v1;
@@ -775,3 +877,4 @@ f4 geometry YES NULL
f5 datetime YES NULL
drop view v1;
drop table t1;
+End of 5.1 tests
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 5d97e540976..f82e52d6370 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1,3 +1,4 @@
+SET GLOBAL log_bin_trust_function_creators = 1;
drop table if exists t1;
drop database if exists mysqltest;
SET NAMES binary;
@@ -1059,4 +1060,135 @@ DROP DATABASE bug23556;
DROP USER bug23556@localhost;
GRANT PROCESS ON * TO user@localhost;
ERROR 3D000: No database selected
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
+DROP DATABASE IF EXISTS mysqltest4;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE DATABASE mysqltest3;
+CREATE DATABASE mysqltest4;
+CREATE PROCEDURE mysqltest1.p_def() SQL SECURITY DEFINER
+SELECT 1;
+CREATE PROCEDURE mysqltest2.p_inv() SQL SECURITY INVOKER
+SELECT 1;
+CREATE FUNCTION mysqltest3.f_def() RETURNS INT SQL SECURITY DEFINER
+RETURN 1;
+CREATE FUNCTION mysqltest4.f_inv() RETURNS INT SQL SECURITY INVOKER
+RETURN 1;
+GRANT EXECUTE ON PROCEDURE mysqltest1.p_def TO mysqltest_1@localhost;
+GRANT EXECUTE ON PROCEDURE mysqltest2.p_inv TO mysqltest_1@localhost;
+GRANT EXECUTE ON FUNCTION mysqltest3.f_def TO mysqltest_1@localhost;
+GRANT EXECUTE ON FUNCTION mysqltest4.f_inv TO mysqltest_1@localhost;
+GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
+
+---> connection: bug9504_con1
+use mysqltest1;
+use mysqltest2;
+use mysqltest3;
+use mysqltest4;
+use test;
+CALL mysqltest1.p_def();
+1
+1
+CALL mysqltest2.p_inv();
+1
+1
+SELECT mysqltest3.f_def();
+mysqltest3.f_def()
+1
+SELECT mysqltest4.f_inv();
+mysqltest4.f_inv()
+1
+
+---> connection: default
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP DATABASE mysqltest3;
+DROP DATABASE mysqltest4;
+DROP USER mysqltest_1@localhost;
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+GRANT ALL PRIVILEGES ON mysqltest1.* TO mysqltest_1@localhost;
+GRANT SELECT ON mysqltest2.* TO mysqltest_1@localhost;
+CREATE PROCEDURE mysqltest1.p1() SQL SECURITY INVOKER
+SELECT 1;
+
+---> connection: bug27337_con1
+CREATE TABLE t1(c INT);
+ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
+CALL mysqltest1.p1();
+1
+1
+CREATE TABLE t1(c INT);
+ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
+
+---> connection: bug27337_con2
+CREATE TABLE t1(c INT);
+ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
+SHOW TABLES;
+Tables_in_mysqltest2
+
+---> connection: default
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP USER mysqltest_1@localhost;
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE TABLE mysqltest1.t1(c INT);
+CREATE TABLE mysqltest2.t2(c INT);
+GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost;
+GRANT SELECT ON mysqltest2.t2 TO mysqltest_2@localhost;
+
+---> connection: bug27337_con1
+SHOW TABLES FROM mysqltest1;
+Tables_in_mysqltest1
+t1
+PREPARE stmt1 FROM 'SHOW TABLES FROM mysqltest1';
+EXECUTE stmt1;
+Tables_in_mysqltest1
+t1
+
+---> connection: bug27337_con2
+SHOW COLUMNS FROM mysqltest2.t2;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+PREPARE stmt2 FROM 'SHOW COLUMNS FROM mysqltest2.t2';
+EXECUTE stmt2;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+
+---> connection: default
+REVOKE SELECT ON mysqltest1.t1 FROM mysqltest_1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest_2@localhost;
+
+---> connection: bug27337_con1
+SHOW TABLES FROM mysqltest1;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest1'
+EXECUTE stmt1;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest1'
+
+---> connection: bug27337_con2
+SHOW COLUMNS FROM mysqltest2.t2;
+ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2'
+EXECUTE stmt2;
+ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2'
+
+---> connection: default
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP USER mysqltest_1@localhost;
End of 5.0 tests
+set names utf8;
+grant select on test.* to юзер_юзер@localhost;
+user()
+юзер_юзер@localhost
+revoke all on test.* from юзер_юзер@localhost;
+drop user юзер_юзер@localhost;
+grant select on test.* to очень_длинный_юзер@localhost;
+ERROR HY000: String 'очень_длинный_юзер' is too long for user name (should be no longer than 16)
+set names default;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index d583eb02aeb..c7464bb21d2 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1035,12 +1035,115 @@ HAVING SUM(t1_inner.b)+t1_outer.b > 5);
ERROR 42000: 'test.t1_outer.b' isn't in GROUP BY
DROP TABLE t1;
SET SQL_MODE = '';
-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;
+CREATE TABLE t1 (a INT, b INT,
+PRIMARY KEY (a),
+KEY i2(a,b));
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
+INSERT INTO t1 SELECT a + 8,b FROM t1;
+INSERT INTO t1 SELECT a + 16,b FROM t1;
+INSERT INTO t1 SELECT a + 32,b FROM t1;
+INSERT INTO t1 SELECT a + 64,b FROM t1;
+INSERT INTO t1 SELECT a + 128,b FROM t1;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN SELECT a FROM t1 WHERE a < 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;
+1 SIMPLE t1 range PRIMARY,i2 PRIMARY 4 NULL 2 Using where; Using index
+EXPLAIN SELECT a FROM t1 WHERE a < 2 ORDER BY a;
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;
+1 SIMPLE t1 range PRIMARY,i2 PRIMARY 4 NULL 2 Using where; Using index
+EXPLAIN SELECT a FROM t1 WHERE a < 2 GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY,i2 PRIMARY 4 NULL 2 Using where; Using index
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY,i2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 256
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 256
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 256 Using index
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 256 Using index; Using filesort
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
+IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 256 Using index
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY) IGNORE INDEX FOR ORDER BY (i2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL i2 9 NULL 256 Using index
+EXPLAIN SELECT a FROM t1 FORCE INDEX (i2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL i2 9 NULL 256 Using index
+EXPLAIN SELECT a FROM t1 USE INDEX ();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 256
+EXPLAIN SELECT a FROM t1 USE INDEX () USE INDEX (i2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 256
+EXPLAIN SELECT a FROM t1
+FORCE INDEX (PRIMARY)
+IGNORE INDEX FOR GROUP BY (i2)
+IGNORE INDEX FOR ORDER BY (i2)
+USE INDEX (i2);
+ERROR HY000: Incorrect usage of USE INDEX and FORCE INDEX
+EXPLAIN SELECT a FROM t1 USE INDEX (i2) USE INDEX ();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL i2 9 NULL 256 Using index
+EXPLAIN SELECT a FROM t1 FORCE INDEX ();
+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
+EXPLAIN SELECT a FROM t1 IGNORE INDEX ();
+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
+EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2)
+USE INDEX FOR GROUP BY (i2) GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL i2 9 NULL 256 Using index
+EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2)
+FORCE INDEX FOR GROUP BY (i2) GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL i2 4 NULL 257 Using index for group-by
+EXPLAIN SELECT a FROM t1 USE INDEX () IGNORE INDEX (i2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 256
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (i2) USE INDEX ();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 256
+EXPLAIN SELECT a FROM t1
+USE INDEX FOR GROUP BY (i2)
+USE INDEX FOR ORDER BY (i2)
+USE INDEX FOR JOIN (i2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL i2 9 NULL 256 Using index
+EXPLAIN SELECT a FROM t1
+USE INDEX FOR JOIN (i2)
+USE INDEX FOR JOIN (i2)
+USE INDEX FOR JOIN (i2,i2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL i2 9 NULL 256 Using index
+EXPLAIN SELECT 1 FROM t1 WHERE a IN
+(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL PRIMARY 4 NULL 256 Using where; Using index
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 256 Using where
+CREATE TABLE t2 (a INT, b INT, KEY(a));
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
+EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL a 5 NULL 4
+EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+EXPLAIN SELECT 1 FROM t2 WHERE a IN
+(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
+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 ALL NULL NULL NULL NULL 256 Using where
+SHOW VARIABLES LIKE 'old';
+Variable_name Value
+old OFF
+SET @@old = off;
+ERROR HY000: Variable 'old' is a read only variable
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 29bdfcbef7a..ddf675e2f73 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -731,3 +731,10 @@ SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
COUNT(*)
2
DROP TABLE t1;
+CREATE TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('', 0);
+ALTER TABLE t1 MODIFY c1 VARCHAR(101);
+SELECT c2 FROM t1;
+c2
+0
+DROP TABLE t1;
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index fd789a39d88..ab4b892170a 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -280,6 +280,33 @@ a
1
1
drop table t1;
+CREATE TABLE t1 (
+c1 CHAR(3),
+c2 INTEGER,
+KEY USING BTREE(c1),
+KEY USING BTREE(c2)
+) ENGINE= MEMORY;
+INSERT INTO t1 VALUES ('ABC',0), ('A',0), ('B',0), ('C',0);
+UPDATE t1 SET c2= c2 + 1 WHERE c1 = 'A';
+SELECT * FROM t1;
+c1 c2
+ABC 0
+A 1
+B 0
+C 0
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 ENUM('1', '2'),
+UNIQUE USING BTREE(c1)
+) ENGINE= MEMORY DEFAULT CHARSET= utf8;
+INSERT INTO t1 VALUES('1'), ('2');
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 SET('1', '2'),
+UNIQUE USING BTREE(c1)
+) ENGINE= MEMORY DEFAULT CHARSET= utf8;
+INSERT INTO t1 VALUES('1'), ('2');
+DROP TABLE t1;
End of 4.1 tests
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
INSERT INTO t1 VALUES(0);
diff --git a/mysql-test/r/help.result b/mysql-test/r/help.result
index 85ca832828d..16719cc8193 100644
--- a/mysql-test/r/help.result
+++ b/mysql-test/r/help.result
@@ -1,63 +1,63 @@
-insert into mysql.help_category(help_category_id,name)values(1,'impossible_category_1');
+insert into mysql.help_category(help_category_id,name)values(10001,'impossible_category_1');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
-select @category1_id:= 1;
-@category1_id:= 1
-1
-insert into mysql.help_category(help_category_id,name)values(2,'impossible_category_2');
+select @category1_id:= 10001;
+@category1_id:= 10001
+10001
+insert into mysql.help_category(help_category_id,name)values(10002,'impossible_category_2');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
-select @category2_id:= 2;
-@category2_id:= 2
-2
-insert into mysql.help_category(help_category_id,name,parent_category_id)values(3,'impossible_category_3',@category2_id);
+select @category2_id:= 10002;
+@category2_id:= 10002
+10002
+insert into mysql.help_category(help_category_id,name,parent_category_id)values(10003,'impossible_category_3',@category2_id);
Warnings:
Warning 1364 Field 'url' doesn't have a default value
-select @category3_id:= 3;
-@category3_id:= 3
-3
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(1,'impossible_function_1',@category1_id,'description of \n impossible_function1\n','example of \n impossible_function1');
+select @category3_id:= 10003;
+@category3_id:= 10003
+10003
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10101,'impossible_function_1',@category1_id,'description of \n impossible_function1\n','example of \n impossible_function1');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
-select @topic1_id:= 1;
-@topic1_id:= 1
-1
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(2,'impossible_function_2',@category1_id,'description of \n impossible_function2\n','example of \n impossible_function2');
+select @topic1_id:= 10101;
+@topic1_id:= 10101
+10101
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10102,'impossible_function_2',@category1_id,'description of \n impossible_function2\n','example of \n impossible_function2');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
-select @topic2_id:= 2;
-@topic2_id:= 2
-2
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(3,'impossible_function_3',@category2_id,'description of \n impossible_function3\n','example of \n impossible_function3');
+select @topic2_id:= 10102;
+@topic2_id:= 10102
+10102
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10103,'impossible_function_3',@category2_id,'description of \n impossible_function3\n','example of \n impossible_function3');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
-select @topic3_id:= 3;
-@topic3_id:= 3
-3
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(4,'impossible_function_4',@category2_id,'description of \n impossible_function4\n','example of \n impossible_function4');
+select @topic3_id:= 10103;
+@topic3_id:= 10103
+10103
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10104,'impossible_function_4',@category2_id,'description of \n impossible_function4\n','example of \n impossible_function4');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
-select @topic4_id:= 4;
-@topic4_id:= 4
-4
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(5,'impossible_function_7',@category3_id,'description of \n impossible_function5\n','example of \n impossible_function7');
+select @topic4_id:= 10104;
+@topic4_id:= 10104
+10104
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10105,'impossible_function_7',@category3_id,'description of \n impossible_function5\n','example of \n impossible_function7');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
-select @topic5_id:= 5;
-@topic5_id:= 5
-5
-insert into mysql.help_keyword(help_keyword_id,name)values(1,'impossible_function_1');
-select @keyword1_id:= 1;
-@keyword1_id:= 1
-1
-insert into mysql.help_keyword(help_keyword_id,name)values(2,'impossible_function_5');
-select @keyword2_id:= 2;
-@keyword2_id:= 2
-2
-insert into mysql.help_keyword(help_keyword_id,name)values(3,'impossible_function_6');
-select @keyword3_id:= 3;
-@keyword3_id:= 3
-3
+select @topic5_id:= 10105;
+@topic5_id:= 10105
+10105
+insert into mysql.help_keyword(help_keyword_id,name)values(10201,'impossible_function_1');
+select @keyword1_id:= 10201;
+@keyword1_id:= 10201
+10201
+insert into mysql.help_keyword(help_keyword_id,name)values(10202,'impossible_function_5');
+select @keyword2_id:= 10202;
+@keyword2_id:= 10202
+10202
+insert into mysql.help_keyword(help_keyword_id,name)values(10203,'impossible_function_6');
+select @keyword3_id:= 10203;
+@keyword3_id:= 10203
+10203
insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword1_id,@topic2_id);
insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword2_id,@topic1_id);
insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword3_id,@topic3_id);
@@ -257,3 +257,12 @@ delete from mysql.help_relation where help_keyword_id=@keyword1_id and help_topi
delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topic_id=@topic1_id;
delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id;
delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id;
+End of 4.1 tests.
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT);
+LOCK TABLES t1 WRITE;
+HELP no_such_topic;
+name is_it_category
+UNLOCK TABLES;
+DROP TABLE t1;
+End of 5.1 tests.
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index e5d6078e863..078946b4d81 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -706,7 +706,7 @@ Warnings:
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
show create table v3;
View Create View
-v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `test`.`sub1`(1) AS `c`
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `sub1`(1) AS `c`
Warnings:
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v2;
@@ -1408,4 +1408,24 @@ select user,db from information_schema.processlist;
user db
user3148 test
drop user user3148@localhost;
+DROP TABLE IF EXISTS server_status;
+DROP EVENT IF EXISTS event_status;
+SET GLOBAL event_scheduler=1;
+CREATE EVENT event_status
+ON SCHEDULE AT NOW()
+ON COMPLETION NOT PRESERVE
+DO
+BEGIN
+CREATE TABLE server_status
+SELECT variable_name
+FROM information_schema.global_status
+WHERE variable_name LIKE 'ABORTED_CONNECTS' OR
+variable_name LIKE 'BINLOG_CACHE_DISK_USE';
+END$$
+SELECT variable_name FROM server_status;
+variable_name
+ABORTED_CONNECTS
+BINLOG_CACHE_DISK_USE
+DROP TABLE server_status;
+SET GLOBAL event_scheduler=0;
End of 5.1 tests.
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index 2a6a3e6e0fb..94ebc213122 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -117,16 +117,82 @@ use testdb_1;
create table t1 (f1 char(4));
create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
+create view v5 as select f1 from t1;
+grant show view on v5 to testdb_2@localhost;
+create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+use testdb_1;
+create view v6 as select f1 from t1;
+grant show view on v6 to testdb_2@localhost;
+create table t2 (f1 char(4));
+create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
+Warnings:
+Note 1449 There is no 'no_such_user'@'no_such_host' registered
+show fields from testdb_1.v6;
+Field Type Null Key Default Extra
+f1 char(4) YES NULL
+show create view testdb_1.v6;
+View Create View
+v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select `t1`.`f1` AS `f1` from `t1`
+show create view testdb_1.v7;
+View Create View
+v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
+Warnings:
+Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+show fields from testdb_1.v7;
+Field Type Null Key Default Extra
+f1 null YES NULL
+Warnings:
+Note 1449 There is no 'no_such_user'@'no_such_host' registered
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
create view v2 as select f1 from testdb_1.v1;
create view v4 as select f1,f2 from testdb_1.v3;
+show fields from testdb_1.v5;
+Field Type Null Key Default Extra
+f1 char(4) YES NULL
+show create view testdb_1.v5;
+View Create View
+v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
+show fields from testdb_1.v6;
+Field Type Null Key Default Extra
+f1 char(4) YES NULL
+show create view testdb_1.v6;
+View Create View
+v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
+show fields from testdb_1.v7;
+Field Type Null Key Default Extra
+f1 null YES NULL
+Warnings:
+Note 1449 There is no 'no_such_user'@'no_such_host' registered
+show create view testdb_1.v7;
+View Create View
+v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
+Warnings:
+Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
revoke insert(f1) on v3 from testdb_2@localhost;
+revoke show view on v5 from testdb_2@localhost;
+use testdb_1;
+revoke show view on v6 from testdb_2@localhost;
+show fields from testdb_1.v5;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5'
+show create view testdb_1.v5;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5'
+show fields from testdb_1.v6;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6'
+show create view testdb_1.v6;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6'
+show fields from testdb_1.v7;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
+show create view testdb_1.v7;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
show create view v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show fields from v4;
-ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+Field Type Null Key Default Extra
+f1 null YES NULL
+f2 char(4) YES NULL
show fields from v2;
Field Type Null Key Default Extra
f1 char(4) YES NULL
@@ -151,7 +217,8 @@ where a.table_name = 'testdb_1.v1';
view_definition
select * from v2;
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
-drop view testdb_1.v1,v2, testdb_1.v3, v4;
+use test;
+drop view testdb_1.v1, v2, testdb_1.v3, v4;
drop database testdb_1;
drop user testdb_1@localhost;
drop user testdb_2@localhost;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index f2d504f555f..4d104c64fa9 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -3159,3 +3159,21 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2, t1;
+CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
+ALTER TABLE t2 MODIFY a INT NOT NULL;
+ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
+DELETE FROM t1;
+DROP TABLE t2,t1;
+CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('DDD');
+SELECT * FROM t1;
+a
+DDD
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb_gis.result b/mysql-test/r/innodb_gis.result
index a65155909f1..e5d921514c5 100644
--- a/mysql-test/r/innodb_gis.result
+++ b/mysql-test/r/innodb_gis.result
@@ -393,7 +393,7 @@ 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
+120 121 0 0 1 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,
@@ -460,5 +460,91 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
+End of 4.1 tests
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
ERROR HY000: The used table type doesn't support SPATIAL indexes
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 18a0ed1a1cb..57339b2e29f 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -730,3 +730,32 @@ f1 f2
2 2
10 10
DROP TABLE t1, t2;
+SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
+CREATE TABLE t1 (c VARCHAR(30), INDEX ix_c (c(10)));
+CREATE TABLE t2 (d VARCHAR(10));
+INSERT INTO t1 (c) VALUES ('7_chars'), ('13_characters');
+EXPLAIN
+SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ref ix_c ix_c 13 const 1 Using where
+SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
+(SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters')
+13
+13
+INSERT INTO t2 (d)
+SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
+INSERT INTO t2 (d)
+SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='7_chars') FROM t1;
+INSERT INTO t2 (d)
+SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c IN (SELECT t1.c FROM t1))
+FROM t1;
+SELECT * FROM t2;
+d
+13
+13
+7
+7
+20
+20
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index f608e0e7895..fed66ed47a7 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -236,3 +236,103 @@ INSERT INTO t2 VALUES (1), (3);
INSERT INTO t1 SELECT 1, COUNT(*) FROM t2 ON DUPLICATE KEY UPDATE j= a;
ERROR 42S22: Unknown column 'a' in 'field list'
DROP TABLE t1,t2;
+SET SQL_MODE = 'TRADITIONAL';
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL);
+INSERT INTO t1 (a) VALUES (1);
+ERROR HY000: Field 'b' doesn't have a default value
+INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b;
+ERROR HY000: Field 'b' doesn't have a default value
+INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b;
+ERROR HY000: Field 'b' doesn't have a default value
+SELECT * FROM t1;
+a b
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INT AUTO_INCREMENT PRIMARY KEY,
+f2 VARCHAR(5) NOT NULL UNIQUE);
+INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1
+INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1
+DROP TABLE t1;
+SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
+CREATE TABLE `t1` (
+`id` int(11) PRIMARY KEY auto_increment,
+`f1` varchar(10) NOT NULL UNIQUE
+);
+INSERT IGNORE INTO t1 (f1) VALUES ("test1")
+ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+INSERT IGNORE INTO t1 (f1) VALUES ("test1")
+ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1
+SELECT * FROM t1;
+id f1
+1 test1
+INSERT IGNORE INTO t1 (f1) VALUES ("test2")
+ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT * FROM t1;
+id f1
+1 test1
+2 test2
+INSERT IGNORE INTO t1 (f1) VALUES ("test2")
+ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2
+SELECT * FROM t1;
+id f1
+1 test1
+2 test2
+INSERT IGNORE INTO t1 (f1) VALUES ("test3")
+ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3
+SELECT * FROM t1;
+id f1
+1 test1
+2 test2
+3 test3
+DROP TABLE t1;
+CREATE TABLE `t1` (
+`id` int(11) PRIMARY KEY auto_increment,
+`f1` varchar(10) NOT NULL UNIQUE
+);
+INSERT IGNORE INTO t1 (f1) VALUES ("test1")
+ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1
+SELECT * FROM t1;
+id f1
+1 test1
+INSERT IGNORE INTO t1 (f1) VALUES ("test1"),("test4")
+ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2
+SELECT * FROM t1;
+id f1
+1 test1
+2 test4
+DROP TABLE t1;
+CREATE TABLE `t1` (
+`id` int(11) PRIMARY KEY auto_increment,
+`f1` varchar(10) NOT NULL UNIQUE,
+tim1 timestamp default '2003-01-01 00:00:00' on update current_timestamp
+);
+INSERT INTO t1 (f1) VALUES ("test1");
+SELECT id, f1 FROM t1;
+id f1
+1 test1
+REPLACE INTO t1 VALUES (0,"test1",null);
+SELECT id, f1 FROM t1;
+id f1
+0 test1
+DROP TABLE t1;
+SET SQL_MODE='';
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index 853b837c46e..e348a387252 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -489,3 +489,44 @@ EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
drop table t1;
+CREATE TABLE t1 (
+a INTEGER auto_increment PRIMARY KEY,
+b INTEGER NOT NULL,
+c INTEGER NOT NULL,
+d CHAR(64)
+);
+CREATE TABLE t2 (
+a INTEGER auto_increment PRIMARY KEY,
+b INTEGER NOT NULL,
+c SMALLINT NOT NULL,
+d DATETIME NOT NULL,
+e SMALLINT NOT NULL,
+f INTEGER NOT NULL,
+g INTEGER NOT NULL,
+h SMALLINT NOT NULL,
+i INTEGER NOT NULL,
+j INTEGER NOT NULL,
+UNIQUE INDEX (b),
+INDEX (b, d, e, f, g, h, i, j, c),
+INDEX (c)
+);
+INSERT INTO t2 VALUES
+(NULL, 1, 254, '1000-01-01 00:00:00', 257, 0, 0, 0, 0, 0),
+(NULL, 2, 1, '2004-11-30 12:00:00', 1, 0, 0, 0, 0, 0),
+(NULL, 3, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -21600, 0),
+(NULL, 4, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -10800, 0),
+(NULL, 5, 1, '2004-11-30 12:00:00', 1, 0, 0, 5, -10800, 0),
+(NULL, 6, 1, '2004-11-30 12:00:00', 102, 0, 0, 0, 0, 0),
+(NULL, 7, 1, '2004-11-30 12:00:00', 105, 2, 0, 0, 0, 0),
+(NULL, 8, 1, '2004-11-30 12:00:00', 105, 10, 0, 0, 0, 0);
+INSERT INTO t1 (b, c, d) VALUES
+(3388000, -553000, NULL),
+(3388000, -553000, NULL);
+SELECT *
+FROM t2 c JOIN t1 pa ON c.b = pa.a
+WHERE c.c = 1
+ORDER BY c.b, c.d
+;
+a b c d e f g h i j a b c d
+2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index c8fcdf14ea0..bb222db74da 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -157,14 +157,23 @@ MYSQLTEST_VARDIR/
set @@secure_file_priv= 0;
ERROR HY000: Variable 'secure_file_priv' is a read only variable
truncate table t1;
-load data infile 'MYSQL_TEST_DIR/Makefile' into table t1;
+load data infile 'MYSQL_TEST_DIR/t/loaddata.test' into table t1;
ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
select * from t1;
a b c
-select load_file("MYSQL_TEST_DIR/Makefile");
-load_file("MYSQL_TEST_DIR/Makefile")
+select load_file("MYSQL_TEST_DIR/t/loaddata.test");
+load_file("MYSQL_TEST_DIR/t/loaddata.test")
NULL
drop table t1, t2;
+create table t1(f1 int);
+insert into t1 values(1),(null);
+create table t2(f2 int auto_increment primary key);
+select * from t2;
+f2
+1
+2
+SET @@SQL_MODE=@OLD_SQL_MODE;
+drop table t1,t2;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1);
SET NAMES latin1;
diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result
index 7cd223197e7..1a2099b7a94 100644
--- a/mysql-test/r/lock.result
+++ b/mysql-test/r/lock.result
@@ -68,6 +68,7 @@ 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;
+End of 4.1 tests.
drop table if exists t1;
create table t1 (a int);
lock table t1 write;
@@ -75,3 +76,23 @@ 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;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT);
+LOCK TABLES mysql.time_zone READ, mysql.proc READ, t1 READ;
+UNLOCK TABLES;
+LOCK TABLES mysql.time_zone READ, mysql.proc READ, t1 WRITE;
+UNLOCK TABLES;
+LOCK TABLES mysql.time_zone READ, mysql.proc READ;
+UNLOCK TABLES;
+LOCK TABLES mysql.time_zone WRITE, mysql.proc WRITE;
+UNLOCK TABLES;
+LOCK TABLES mysql.time_zone READ, mysql.proc WRITE, t1 READ;
+ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
+LOCK TABLES mysql.time_zone WRITE, mysql.proc WRITE, t1 READ;
+ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
+LOCK TABLES mysql.time_zone WRITE, mysql.proc WRITE, t1 WRITE;
+ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
+LOCK TABLES mysql.time_zone READ, mysql.proc WRITE;
+ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
+DROP TABLE t1;
+End of 5.1 tests.
diff --git a/mysql-test/r/log_tables-big.result b/mysql-test/r/log_tables-big.result
new file mode 100644
index 00000000000..9b81127c825
--- /dev/null
+++ b/mysql-test/r/log_tables-big.result
@@ -0,0 +1,29 @@
+set session long_query_time=10;
+select get_lock('bug27638', 1);
+get_lock('bug27638', 1)
+1
+set session long_query_time=1;
+truncate table mysql.slow_log;
+select get_lock('bug27638', 2);
+get_lock('bug27638', 2)
+0
+select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+qt sql_text
+OK select get_lock('bug27638', 2)
+truncate table mysql.slow_log;
+select get_lock('bug27638', 60);
+get_lock('bug27638', 60)
+0
+select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+qt sql_text
+OK select get_lock('bug27638', 60)
+truncate table mysql.slow_log;
+select get_lock('bug27638', 101);
+get_lock('bug27638', 101)
+0
+select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+qt sql_text
+OK select get_lock('bug27638', 101)
+select release_lock('bug27638');
+release_lock('bug27638')
+1
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index c654392f6e1..6cbdaf6f4f8 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -806,6 +806,19 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1;
+CREATE TABLE t1(c1 VARCHAR(1));
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+c1
+DROP TABLE t1, m1;
+CREATE TABLE t1(c1 VARCHAR(4), c2 TINYINT, c3 TINYINT, c4 TINYINT,
+c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT, c9 TINYINT);
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+c1 c2 c3 c4 c5 c6 c7 c8 c9
+DROP TABLE t1, m1;
create table t1 (b bit(1));
create table t2 (b bit(1));
create table tm (b bit(1)) engine = merge union = (t1,t2);
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index bb666b2e499..dcb471510cd 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -943,6 +943,156 @@ 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 MyISAM 10 Dynamic X X X 72057594037927935 X X X X X X latin1_swedish_ci X max_rows=4100100100 avg_row_length=70100
DROP TABLE t1;
+CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+(''), (''), (''), (''),
+(' B'), (' B'), (' B'), (' B');
+SELECT DISTINCT COUNT(*) FROM t1 WHERE c1 = '';
+COUNT(*)
+4
+SELECT DISTINCT length(c1), c1 FROM t1 WHERE c1 = '';
+length(c1) c1
+0
+SELECT DISTINCT COUNT(*) FROM t1 IGNORE INDEX (c1) WHERE c1 = '';
+COUNT(*)
+4
+SELECT DISTINCT length(c1), c1 FROM t1 IGNORE INDEX (c1) WHERE c1 = '';
+length(c1) c1
+0
+SELECT DISTINCT length(c1), c1 FROM t1 ORDER BY c1;
+length(c1) c1
+0
+2 A
+2 B
+DROP TABLE t1;
End of 4.1 tests
set storage_engine=MyISAM;
drop table if exists t1,t2,t3;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index e83bbe97eaa..61d04deef51 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -167,7 +167,7 @@ ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'invalid_hostname' (errn
The commands reported in the bug report
ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'cyril has found a bug :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' (errno)
Too long dbname
-ERROR 1049 (42000) at line 1: Unknown database 'test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
+ERROR 1102 (42000) at line 1: Incorrect database name 'test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
Too long hostname
ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' (errno)
1
diff --git a/mysql-test/r/mysql_protocols.result b/mysql-test/r/mysql_protocols.result
index cbead9254a2..c6207c4f4f5 100644
--- a/mysql-test/r/mysql_protocols.result
+++ b/mysql-test/r/mysql_protocols.result
@@ -7,3 +7,4 @@ SOCKET
ERROR 2047 (HY000): Wrong or unknown protocol
ERROR 2047 (HY000): Wrong or unknown protocol
Unknown option to protocol: NullS
+Alternatives are: 'TCP','SOCKET','PIPE','MEMORY'
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 5a7dcca2420..57961698034 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -290,23 +290,23 @@ SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
create table t1 (a varchar(64) character set utf8)/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-6-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-7-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-8-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-9-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-a-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-b-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/;
SET TIMESTAMP=1000000000/*!*/;
drop table t1/*!*/;
DELIMITER ;
diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result
index e76ab71fd54..ef6e4ee80fd 100644
--- a/mysql-test/r/mysqlbinlog2.result
+++ b/mysql-test/r/mysqlbinlog2.result
@@ -122,6 +122,23 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+--- start and stop positions ---
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+SET INSERT_ID=4/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1579609946/*!*/;
+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/*!*/;
+insert into t1 values(null, "d")/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
@@ -482,6 +499,23 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+--- start and stop positions ---
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+SET INSERT_ID=4/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1579609946/*!*/;
+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/*!*/;
+insert into t1 values(null, "d")/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 0190094f0ba..d898869caac 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -1568,29 +1568,17 @@ create table t3(a varchar(30) primary key, b int not null);
test_sequence
------ Testing with illegal table names ------
mysqldump: Couldn't find table: "\d-2-1.sql"
-
mysqldump: Couldn't find table: "\t1"
-
mysqldump: Couldn't find table: "\t1"
-
mysqldump: Couldn't find table: "\\t1"
-
mysqldump: Couldn't find table: "t\1"
-
mysqldump: Couldn't find table: "t\1"
-
mysqldump: Couldn't find table: "t/1"
-
mysqldump: Couldn't find table: "T_1"
-
mysqldump: Couldn't find table: "T%1"
-
mysqldump: Couldn't find table: "T'1"
-
mysqldump: Couldn't find table: "T_1"
-
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
@@ -3217,6 +3205,83 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
</mysqldump>
DROP TABLE t1;
#
+# Bug#26346: stack + buffer overrun in mysqldump
+#
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2);
+mysqldump: Input filename or options too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+DROP TABLE t1;
+CREATE TABLE t2 (a int);
+CREATE TABLE t3 (a int);
+CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
+
+/*!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
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`);
+DROP TABLE IF EXISTS `t2`;
+CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t2` WRITE;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
+/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `t3`;
+CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t3` WRITE;
+/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
+/*!40000 ALTER TABLE `t3` 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, t2, t3;
+#
+# Bug #23491: MySQLDump prefix function call in a view by database name
+#
+create database bug23491_original;
+create database bug23491_restore;
+use bug23491_original;
+create table t1 (c1 int);
+create view v1 as select * from t1;
+create procedure p1() select 1;
+create function f1() returns int return 1;
+create view v2 as select f1();
+create function f2() returns int return f1();
+create view v3 as select bug23491_original.f1();
+use bug23491_restore;
+show create view bug23491_restore.v2;
+View Create View
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `f1`() AS `f1()`
+show create view bug23491_restore.v3;
+View Create View
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `bug23491_original`.`f1`() AS `bug23491_original.f1()`
+drop database bug23491_original;
+drop database bug23491_restore;
+use test;
+#
# End of 5.0 tests
#
drop table if exists t1;
@@ -3440,35 +3505,35 @@ 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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1
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
+Event sql_mode time_zone Create Event
+ee1 UTC 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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1
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
+Event sql_mode time_zone Create Event
+ee1 NO_AUTO_VALUE_ON_ZERO UTC 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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1
+second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1
+second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1
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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
+third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1
+third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1
+third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1
drop database third;
set time_zone = 'SYSTEM';
use test;
diff --git a/mysql-test/r/mysqlslap.result b/mysql-test/r/mysqlslap.result
index 1a8b77fde1c..bca7919d78c 100644
--- a/mysql-test/r/mysqlslap.result
+++ b/mysql-test/r/mysqlslap.result
@@ -143,3 +143,27 @@ select * from t1;
select * from t2;
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');
+SHOW TABLES;
+select * from t1;
+SHOW TABLES;
+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');
+SHOW TABLES;
+select * from t1;
+SHOW TABLES;
+DROP SCHEMA IF EXISTS `mysqlslap`;
diff --git a/mysql-test/r/ndb_binlog_ddl_multi.result b/mysql-test/r/ndb_binlog_ddl_multi.result
index eff91eca236..6631feeaa17 100644
--- a/mysql-test/r/ndb_binlog_ddl_multi.result
+++ b/mysql-test/r/ndb_binlog_ddl_multi.result
@@ -10,30 +10,32 @@ 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
+master-bin1.000001 # Query 1 # create database mysqltest
+master-bin1.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb
+master-bin1.000001 # Query 102 # 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
+master-bin.000001 # Query 1 # create database mysqltest
+master-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb
+master-bin.000001 # Query 102 # 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-bin.000001 # Query # # use `test`; alter table t2 add column (b int)
+master-bin.000001 # Query 102 # 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
+master-bin.000001 # Query 102 # ALTER DATABASE mysqltest CHARACTER SET latin1
+master-bin.000001 # Query 102 # use `mysqltest`; drop table `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
+master-bin.000001 # Query 102 # ALTER DATABASE mysqltest CHARACTER SET latin1
+master-bin.000001 # Query 102 # use `mysqltest`; drop table `t1`
reset master;
reset master;
use test;
@@ -42,14 +44,14 @@ 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: # (mysql.ndb_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
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t2)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 1 # drop database mysqltest
+master-bin1.000001 # Query 1 # use `test`; create table t1 (a int primary key) engine=ndb
drop table t2;
reset master;
reset master;
@@ -83,63 +85,63 @@ 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
+master-bin1.000001 # Query 1 # 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
+master-bin1.000001 # Query 1 # ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query # # CREATE TABLESPACE ts1
+master-bin1.000001 # Query 1 # CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE = NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat'
ENGINE = NDB
-master-bin1.000001 # Query # # DROP TABLESPACE ts1
+master-bin1.000001 # Query 1 # DROP TABLESPACE ts1
ENGINE = NDB
-master-bin1.000001 # Query # # DROP LOGFILE GROUP lg1
+master-bin1.000001 # Query 1 # 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
+master-bin1.000001 # Query 1 # 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
+master-bin1.000001 # Query 1 # ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query # # CREATE TABLESPACE ts1
+master-bin1.000001 # Query 1 # CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE = NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat'
ENGINE = NDB
-master-bin1.000001 # Query # # DROP TABLESPACE ts1
+master-bin1.000001 # Query 1 # DROP TABLESPACE ts1
ENGINE = NDB
-master-bin1.000001 # Query # # DROP LOGFILE GROUP lg1
+master-bin1.000001 # Query 1 # DROP LOGFILE GROUP lg1
ENGINE =NDB
drop table t1;
reset master;
@@ -154,13 +156,13 @@ 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`
+master-bin1.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
+master-bin1.000001 # Query 1 # use `test`; create table t2 (a int key) engine=ndb
+master-bin1.000001 # Query 1 # use `test`; create table t3 (a int key) engine=ndb
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t3` to `test.t4`
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t2` to `test.t3`
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t4` to `test.t1`
drop table t1;
drop table t2;
drop table t3;
@@ -177,18 +179,18 @@ 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: # (mysql.ndb_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: # (mysql.ndb_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
+master-bin1.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t1)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t2)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 102 # use `test`; drop table t2
diff --git a/mysql-test/r/ndb_binlog_discover.result b/mysql-test/r/ndb_binlog_discover.result
index 4806047a016..7c3a976c4d5 100644
--- a/mysql-test/r/ndb_binlog_discover.result
+++ b/mysql-test/r/ndb_binlog_discover.result
@@ -3,10 +3,15 @@ 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: # (mysql.ndb_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 # Incident 1 # #1 (LOST_EVENTS)
+master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
+PURGE MASTER LOGS TO 'master-bin.000002';
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query 1 # BEGIN
+master-bin.000002 # Table_map 1 # table_id: # (test.t1)
+master-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_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
drop table t1;
diff --git a/mysql-test/r/ndb_binlog_ignore_db.result b/mysql-test/r/ndb_binlog_ignore_db.result
index 952d048ad8d..e4c9faa802c 100644
--- a/mysql-test/r/ndb_binlog_ignore_db.result
+++ b/mysql-test/r/ndb_binlog_ignore_db.result
@@ -7,5 +7,5 @@ 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
+master-bin.000001 # Query 1 # use `test`; drop table if exists t1
drop database mysqltest;
diff --git a/mysql-test/r/ndb_binlog_log_bin.result b/mysql-test/r/ndb_binlog_log_bin.result
new file mode 100644
index 00000000000..f80a46324e0
--- /dev/null
+++ b/mysql-test/r/ndb_binlog_log_bin.result
@@ -0,0 +1,80 @@
+drop table if exists t1,t2,t3;
+reset master;
+drop table if exists t1,t2,t3;
+reset master;
+set SQL_LOG_BIN=0;
+create database mysqltest;
+use mysqltest;
+create table t1 (a int key, b int) engine=ndb;
+create table t2 (a int key, b int) engine=ndb;
+insert into t1 values (1,1);
+alter table t1 add c int;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
+reset master;
+use mysqltest;
+insert into t2 values (1,1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t1)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t2)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+reset master;
+use mysqltest;
+drop table t1;
+drop table t2;
+create table t1 (d int key, e int) engine=ndb;
+create table t2 (d int key, e 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 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_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 `mysqltest`; drop table t1
+master-bin.000001 # Query 1 # use `mysqltest`; drop table t2
+master-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
+master-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_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
+use mysqltest;
+insert into t2 values (1,1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query 1 # use `mysqltest`; drop table `t1`
+master-bin1.000001 # Query 1 # use `mysqltest`; drop table `t2`
+master-bin1.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
+master-bin1.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t1)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t2)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+drop database mysqltest;
diff --git a/mysql-test/r/ndb_binlog_multi.result b/mysql-test/r/ndb_binlog_multi.result
index 3a84c89a7a4..bf9b34db64b 100644
--- a/mysql-test/r/ndb_binlog_multi.result
+++ b/mysql-test/r/ndb_binlog_multi.result
@@ -8,13 +8,14 @@ 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: # (mysql.ndb_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 102 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t2)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
select * from t2 order by a;
a b
1 1
@@ -30,14 +31,15 @@ a b
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: # (mysql.ndb_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
+master-bin.000001 # Query 102 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
+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 # COMMIT
+master-bin.000001 # Query 1 # use `test`; DROP TABLE t2
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch=<the_epoch>;
inserts updates deletes schemaops
@@ -48,13 +50,14 @@ 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: # (mysql.ndb_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 102 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t1)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
@the_epoch2:=epoch inserts updates deletes schemaops
@@ -66,14 +69,15 @@ inserts updates deletes schemaops
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: # (mysql.ndb_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
+master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t1)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 102 # use `test`; drop table t1
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
inserts updates deletes schemaops
diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result
index ad33c7994d1..34f2c5fdd66 100644
--- a/mysql-test/r/ndb_blob.result
+++ b/mysql-test/r/ndb_blob.result
@@ -76,6 +76,8 @@ commit;
select a from t1 where d is null;
a
1
+delete from t1 where a=45567;
+commit;
delete from t1 where a=1;
delete from t1 where a=2;
commit;
diff --git a/mysql-test/r/ndb_dd_basic.result b/mysql-test/r/ndb_dd_basic.result
index 014858e6856..7aeb156869b 100644
--- a/mysql-test/r/ndb_dd_basic.result
+++ b/mysql-test/r/ndb_dd_basic.result
@@ -186,6 +186,34 @@ 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 tablespace ts2
+add datafile 'datafile2_1.dat'
+use logfile group lg1
+initial_size 12M
+engine ndb;
+CREATE TABLE City (
+ID int(11) NOT NULL AUTO_INCREMENT,
+Name char(35) NOT NULL,
+CountryCode char(3) NOT NULL,
+District char(20) NOT NULL,
+Population int(11) NOT NULL,
+PRIMARY KEY (ID)
+) ENGINE=ndbcluster
+tablespace ts2
+storage disk;
+alter tablespace ts2
+drop datafile 'datafile2_1.dat'
+engine ndb;
+insert
+into City (Name,CountryCode,District,Population)
+values ('BeiJing','CN','Beijing',2000);
+ERROR HY000: Got error 1602 'No datafile in tablespace' from NDBCLUSTER
+drop tablespace ts2
+engine ndb;
+ERROR HY000: Failed to drop TABLESPACE
+drop table City;
+drop tablespace ts2
+engine ndb;
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;
@@ -440,6 +468,13 @@ insert into t1 values(7,'x');
insert into t1 values(8,'x');
delete from t1 where a = 0;
commit;
+delete from t1;
+begin;
+insert into t1 values (1, 'x');
+select * from t1;
+a b
+1 x
+rollback;
set autocommit = 1;
drop table t1;
create table test.t1 (f1 varchar(50) primary key, f2 text,f3 int)
diff --git a/mysql-test/r/ndb_gis.result b/mysql-test/r/ndb_gis.result
index 23341ee0216..279a0884b5b 100644
--- a/mysql-test/r/ndb_gis.result
+++ b/mysql-test/r/ndb_gis.result
@@ -393,7 +393,7 @@ 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
+120 121 0 0 1 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,
@@ -460,6 +460,94 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
+End of 4.1 tests
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+Warnings:
+Error 1466 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
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 PRIMARY KEY AUTO_INCREMENT, g POINT);
@@ -855,7 +943,7 @@ 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
+120 121 0 0 1 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,
@@ -922,3 +1010,91 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
+End of 4.1 tests
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+Warnings:
+Error 1466 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/ndb_partition_error2.result b/mysql-test/r/ndb_partition_error2.result
new file mode 100644
index 00000000000..a739ef3923c
--- /dev/null
+++ b/mysql-test/r/ndb_partition_error2.result
@@ -0,0 +1,3 @@
+drop table if exists t1;
+create table t1 (s1 int) engine=ndbcluster;
+ERROR HY000: For the partitioned engine it is necessary to define all partitions
diff --git a/mysql-test/r/ndb_partition_key.result b/mysql-test/r/ndb_partition_key.result
index e294807b40d..685137b7710 100644
--- a/mysql-test/r/ndb_partition_key.result
+++ b/mysql-test/r/ndb_partition_key.result
@@ -57,6 +57,7 @@ Number of primary keys: 3
Length of frm data: #
Row Checksum: 1
Row GCI: 1
+SingleUserMode: 0
TableStatus: Retrieved
-- Attributes --
a Int PRIMARY KEY AT=FIXED ST=MEMORY
diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result
index b946d97bea1..b57fc2e14ba 100644
--- a/mysql-test/r/ndb_restore.result
+++ b/mysql-test/r/ndb_restore.result
@@ -2,12 +2,12 @@ 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_c` (
-`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
+`capgoaledatta` mediumint(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');
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(400,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3000,'20','threetrees.qt');
CREATE TABLE `t2_c` (
`capgotod` smallint(5) unsigned NOT NULL auto_increment,
`gotod` smallint(5) unsigned NOT NULL default '0',
@@ -16,9 +16,9 @@ CREATE TABLE `t2_c` (
`descrpooppo` varchar(64) default NULL,
`svcutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capgotod`),
-KEY `i_quadaddsvr` (`gotod`)
+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');
+INSERT INTO `t2_c` VALUES (500,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',
@@ -36,7 +36,7 @@ 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);
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(2200,'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),(32000,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(290000000,'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',
@@ -53,7 +53,7 @@ PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
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',
+`dardtestard` tinyint(3) unsigned NOT NULL auto_increment,
`FastFA` char(5) NOT NULL default '',
`FastCode` char(6) NOT NULL default '',
`Fastca` char(1) NOT NULL default '',
@@ -118,6 +118,7 @@ PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
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);
+insert into t10_c values (10000),(2000),(3000);
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;
@@ -240,6 +241,24 @@ a
1
2
3
+2000
+3000
+10000
+show table status like 't1_c';
+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
+X X X X X X X X X X 3001 X X X X X X X
+show table status like 't2_c';
+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
+X X X X X X X X X X 501 X X X X X X X
+show table status like 't4_c';
+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
+X X X X X X X X X X 290000001 X X X X X X X
+show table status like 't7_c';
+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
+X X X X X X X X X X 29 X X X X X X X
+show table status like 't10_c';
+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
+X X X X X X X X X X 10001 X X X X X X X
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;
diff --git a/mysql-test/r/ndb_restore_compat.result b/mysql-test/r/ndb_restore_compat.result
index f580f680687..d495aa28135 100644
--- a/mysql-test/r/ndb_restore_compat.result
+++ b/mysql-test/r/ndb_restore_compat.result
@@ -45,8 +45,8 @@ SYSTEM_VALUES_ID VALUE
0 2039
1 3
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
-server_id epoch
-0 151
+server_id epoch log_name start_pos end_pos
+0 151 0 0
TRUNCATE GL;
TRUNCATE ACCOUNT;
TRUNCATE TRANSACTION;
@@ -99,6 +99,6 @@ SYSTEM_VALUES_ID VALUE
0 2297
1 5
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
-server_id epoch
-0 331
+server_id epoch log_name start_pos end_pos
+0 331 0 0
DROP DATABASE BANK;
diff --git a/mysql-test/r/ndb_restore_print.result b/mysql-test/r/ndb_restore_print.result
new file mode 100644
index 00000000000..e05f8e43d1a
--- /dev/null
+++ b/mysql-test/r/ndb_restore_print.result
@@ -0,0 +1,321 @@
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+create table t1
+(pk int key
+,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
+,b1 TINYINT, b2 TINYINT UNSIGNED
+,c1 SMALLINT, c2 SMALLINT UNSIGNED
+,d1 INT, d2 INT UNSIGNED
+,e1 BIGINT, e2 BIGINT UNSIGNED
+,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
+,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+) engine myisam;
+insert into t1 values
+(1
+,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
+,127, 255
+,32767, 65535
+,2147483647, 4294967295
+,9223372036854775807, 18446744073709551615
+,'1','12345678901234567890123456789012','123456789'
+ ,'1','12345678901234567890123456789012','123456789'
+ ,0x12,0x123456789abcdef0, 0x012345
+,0x12,0x123456789abcdef0, 0x00123450
+);
+insert into t1 values
+(2
+,0, 0, 0, 0, 0
+,-128, 0
+,-32768, 0
+,-2147483648, 0
+,-9223372036854775808, 0
+,'','',''
+ ,'','',''
+ ,0x0,0x0,0x0
+,0x0,0x0,0x0
+);
+insert into t1 values
+(3
+,NULL,NULL,NULL,NULL,NULL
+,NULL,NULL
+,NULL,NULL
+,NULL,NULL
+,NULL,NULL
+,NULL,NULL,NULL
+,NULL,NULL,NULL
+,NULL,NULL,NULL
+,NULL,NULL,NULL
+);
+select pk
+,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
+,b1, b2
+,c1 , c2
+,d1 , d2
+,e1 , e2
+,f1 , f2, f3
+,g1 , g2, g3
+,hex(h1), hex(h2), hex(h3)
+,hex(i1), hex(i2), hex(i3)
+from t1 order by pk;
+pk 1
+hex(a1) 1
+hex(a2) 17
+hex(a3) 789A
+hex(a4) 789ABCDE
+hex(a5) FEDC0001
+b1 127
+b2 255
+c1 32767
+c2 65535
+d1 2147483647
+d2 4294967295
+e1 9223372036854775807
+e2 18446744073709551615
+f1 1
+f2 12345678901234567890123456789012
+f3 123456789
+g1 1
+g2 12345678901234567890123456789012
+g3 123456789
+hex(h1) 12
+hex(h2) 123456789ABCDEF0
+hex(h3) 012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+hex(i1) 12
+hex(i2) 123456789ABCDEF0
+hex(i3) 00123450
+pk 2
+hex(a1) 0
+hex(a2) 0
+hex(a3) 0
+hex(a4) 0
+hex(a5) 0
+b1 -128
+b2 0
+c1 -32768
+c2 0
+d1 -2147483648
+d2 0
+e1 -9223372036854775808
+e2 0
+f1
+f2
+f3
+g1
+g2
+g3
+hex(h1) 00
+hex(h2) 0000000000000000
+hex(h3) 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+hex(i1) 00
+hex(i2) 00
+hex(i3) 00
+pk 3
+hex(a1) NULL
+hex(a2) NULL
+hex(a3) NULL
+hex(a4) NULL
+hex(a5) NULL
+b1 NULL
+b2 NULL
+c1 NULL
+c2 NULL
+d1 NULL
+d2 NULL
+e1 NULL
+e2 NULL
+f1 NULL
+f2 NULL
+f3 NULL
+g1 NULL
+g2 NULL
+g3 NULL
+hex(h1) NULL
+hex(h2) NULL
+hex(h3) NULL
+hex(i1) NULL
+hex(i2) NULL
+hex(i3) NULL
+alter table t1 engine ndb;
+select pk
+,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
+,b1, b2
+,c1 , c2
+,d1 , d2
+,e1 , e2
+,f1 , f2, f3
+,g1 , g2, g3
+,hex(h1), hex(h2), hex(h3)
+,hex(i1), hex(i2), hex(i3)
+from t1 order by pk;
+pk 1
+hex(a1) 1
+hex(a2) 17
+hex(a3) 789A
+hex(a4) 789ABCDE
+hex(a5) FEDC0001
+b1 127
+b2 255
+c1 32767
+c2 65535
+d1 2147483647
+d2 4294967295
+e1 9223372036854775807
+e2 18446744073709551615
+f1 1
+f2 12345678901234567890123456789012
+f3 123456789
+g1 1
+g2 12345678901234567890123456789012
+g3 123456789
+hex(h1) 12
+hex(h2) 123456789ABCDEF0
+hex(h3) 012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+hex(i1) 12
+hex(i2) 123456789ABCDEF0
+hex(i3) 00123450
+pk 2
+hex(a1) 0
+hex(a2) 0
+hex(a3) 0
+hex(a4) 0
+hex(a5) 0
+b1 -128
+b2 0
+c1 -32768
+c2 0
+d1 -2147483648
+d2 0
+e1 -9223372036854775808
+e2 0
+f1
+f2
+f3
+g1
+g2
+g3
+hex(h1) 00
+hex(h2) 0000000000000000
+hex(h3) 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+hex(i1) 00
+hex(i2) 00
+hex(i3) 00
+pk 3
+hex(a1) NULL
+hex(a2) NULL
+hex(a3) NULL
+hex(a4) NULL
+hex(a5) NULL
+b1 NULL
+b2 NULL
+c1 NULL
+c2 NULL
+d1 NULL
+d2 NULL
+e1 NULL
+e2 NULL
+f1 NULL
+f2 NULL
+f3 NULL
+g1 NULL
+g2 NULL
+g3 NULL
+hex(h1) NULL
+hex(h2) NULL
+hex(h3) NULL
+hex(i1) NULL
+hex(i2) NULL
+hex(i3) NULL
+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;
+1;0x1;0x17;0x789A;0x789ABCDE;0xFEDC0001;127;255;32767;65535;2147483647;4294967295;9223372036854775807;18446744073709551615;1;12345678901234567890123456789012;123456789;1;12345678901234567890123456789012;123456789;0x12;0x123456789ABCDEF0;0x012345;0x12;0x123456789ABCDEF0;0x00123450
+2;0x0;0x0;0x0;0x0;0x0;-128;0;-32768;0;-2147483648;0;-9223372036854775808;0;;;;;;;0x0;0x0;0x0;0x0;0x0;0x0
+3;\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
+1,0x1,0x17,0x789A,0x789ABCDE,0xFEDC0001,127,255,32767,65535,2147483647,4294967295,9223372036854775807,18446744073709551615,'1','12345678901234567890123456789012','123456789','1','12345678901234567890123456789012','123456789',0x12,0x123456789ABCDEF0,0x012345,0x12,0x123456789ABCDEF0,0x00123450
+2,0x0,0x0,0x0,0x0,0x0,-128,0,-32768,0,-2147483648,0,-9223372036854775808,0,'','','','','','',0x0,0x0,0x0,0x0,0x0,0x0
+3,,,,,,,,,,,,,,,,,,,,,,,,,
+drop table t1;
+create table t1
+(pk int key
+,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+,h1 BINARY(1), h2 BINARY(9), h3 BINARY(255)
+,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+) engine ndb;
+insert into t1 values
+(1
+,'1','12345678901234567890123456789012','123456789 '
+ ,'1 ','12345678901234567890123456789012 ','123456789 '
+ ,0x20,0x123456789abcdef020, 0x012345000020
+,0x1200000020,0x123456789abcdef000000020, 0x00123450000020
+);
+create table t2 (pk int key, a int) engine ndb;
+create table t3 (pk int key, a int) engine ndb;
+create table t4 (pk int key, a int) engine ndb;
+insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
+insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
+insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
+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;
+'1' '1' '12345678901234567890123456789012' '123456789' '1' '12345678901234567890123456789012' '123456789' '0x20' '0x123456789ABCDEF020' '0x012345000020' '0x1200000020' '0x123456789ABCDEF000000020' '0x00123450000020'
+
+t1
+--
+1 1 12345678901234567890123456789012 123456789 1 12345678901234567890123456789012 123456789 0x20 0x123456789ABCDEF020 0x012345000020 0x1200000020 0x123456789ABCDEF000000020 0x00123450000020
+
+t2
+--
+1 11
+2 12
+3 13
+4 14
+5 15
+
+t3
+--
+1 21
+2 22
+3 23
+4 24
+5 25
+
+t4
+--
+1 31
+2 32
+3 33
+4 34
+5 35
+drop table t1;
+create table t1
+(pk int key
+,a1 MEDIUMINT, a2 MEDIUMINT UNSIGNED
+) engine ndb;
+insert into t1 values(1, 8388607, 16777215);
+insert into t1 values(2, -8388608, 0);
+insert into t1 values(3, -1, 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;
+1;8388607;16777215
+2;-8388608;0
+3;-1;1
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
diff --git a/mysql-test/r/ndb_single_user.result b/mysql-test/r/ndb_single_user.result
new file mode 100644
index 00000000000..732acc6f000
--- /dev/null
+++ b/mysql-test/r/ndb_single_user.result
@@ -0,0 +1,59 @@
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+create table t1 (a int key, b int unique, c int) engine ndb;
+ERROR HY000: Can't create table 'test.t1' (errno: 299)
+create table t1 (a int key, b int unique, c int) engine ndb;
+insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
+create table t2 as select * from t1;
+select * from t1 where a = 1;
+a b c
+1 1 0
+select * from t1 where b = 4;
+a b c
+4 4 0
+select * from t1 where a > 4 order by a;
+a b c
+5 5 0
+6 6 0
+7 7 0
+8 8 0
+9 9 0
+10 10 0
+update t1 set b=102 where a = 2;
+update t1 set b=103 where b = 3;
+update t1 set b=b+100;
+update t1 set b=b+100 where a > 7;
+delete from t1;
+insert into t1 select * from t2;
+drop table t1;
+ERROR 42S02: Unknown table 't1'
+create index new_index on t1 (c);
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+select * from t1 where a = 1;
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+select * from t1 where b = 4;
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+update t1 set b=102 where a = 2;
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+update t1 set b=103 where b = 3;
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+update t1 set b=b+100;
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+update t1 set b=b+100 where a > 7;
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+BEGIN;
+update t1 set b=b+100 where a=1;
+BEGIN;
+update t1 set b=b+100 where a=2;
+update t1 set b=b+100 where a=3;
+COMMIT;
+update t1 set b=b+100 where a=4;
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+COMMIT;
+ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
+create table t2 (a int) engine myisam;
+alter table t2 add column (b int);
+drop table t2;
+drop table t1;
diff --git a/mysql-test/r/ndb_trigger.result b/mysql-test/r/ndb_trigger.result
index 2aeca5db2d3..28f9f9bdc37 100644
--- a/mysql-test/r/ndb_trigger.result
+++ b/mysql-test/r/ndb_trigger.result
@@ -141,4 +141,175 @@ a b
drop trigger t4_au;
drop trigger t4_ad;
drop table t1, t2, t3, t4, t5;
+CREATE TABLE t1 (
+id INT NOT NULL PRIMARY KEY,
+xy INT
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (1, 0);
+CREATE TRIGGER t1_update AFTER UPDATE ON t1 FOR EACH ROW BEGIN REPLACE INTO t2 SELECT * FROM t1 WHERE t1.id = NEW.id; END //
+CREATE TABLE t2 (
+id INT NOT NULL PRIMARY KEY,
+xy INT
+) ENGINE=ndbcluster;
+INSERT INTO t2 VALUES (2, 0);
+CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY) ENGINE=ndbcluster;
+INSERT INTO t3 VALUES (1);
+CREATE TABLE t4 LIKE t1;
+CREATE TRIGGER t4_update AFTER UPDATE ON t4 FOR EACH ROW BEGIN REPLACE INTO t5 SELECT * FROM t4 WHERE t4.id = NEW.id; END //
+CREATE TABLE t5 LIKE t2;
+UPDATE t1 SET xy = 3 WHERE id = 1;
+SELECT xy FROM t1 where id = 1;
+xy
+3
+SELECT xy FROM t2 where id = 1;
+xy
+3
+UPDATE t1 SET xy = 4 WHERE id IN (SELECT id FROM t3 WHERE id = 1);
+SELECT xy FROM t1 where id = 1;
+xy
+4
+SELECT xy FROM t2 where id = 1;
+xy
+4
+INSERT INTO t4 SELECT * FROM t1;
+INSERT INTO t5 SELECT * FROM t2;
+UPDATE t1,t4 SET t1.xy = 3, t4.xy = 3 WHERE t1.id = 1 AND t4.id = 1;
+SELECT xy FROM t1 where id = 1;
+xy
+3
+SELECT xy FROM t2 where id = 1;
+xy
+3
+SELECT xy FROM t4 where id = 1;
+xy
+3
+SELECT xy FROM t5 where id = 1;
+xy
+3
+UPDATE t1,t4 SET t1.xy = 4, t4.xy = 4 WHERE t1.id IN (SELECT id FROM t3 WHERE id = 1) AND t4.id IN (SELECT id FROM t3 WHERE id = 1);
+SELECT xy FROM t1 where id = 1;
+xy
+4
+SELECT xy FROM t2 where id = 1;
+xy
+4
+SELECT xy FROM t4 where id = 1;
+xy
+4
+SELECT xy FROM t5 where id = 1;
+xy
+4
+INSERT INTO t1 VALUES (1,0) ON DUPLICATE KEY UPDATE xy = 5;
+SELECT xy FROM t1 where id = 1;
+xy
+5
+SELECT xy FROM t2 where id = 1;
+xy
+5
+DROP TRIGGER t1_update;
+DROP TRIGGER t4_update;
+CREATE TRIGGER t1_delete AFTER DELETE ON t1 FOR EACH ROW BEGIN REPLACE INTO t2 SELECT * FROM t1 WHERE t1.id > 4; END //
+CREATE TRIGGER t4_delete AFTER DELETE ON t4 FOR EACH ROW BEGIN REPLACE INTO t5 SELECT * FROM t4 WHERE t4.id > 4; END //
+INSERT INTO t1 VALUES (5, 0),(6,0);
+INSERT INTO t2 VALUES (5, 1),(6,1);
+INSERT INTO t3 VALUES (5);
+SELECT * FROM t1 order by id;
+id xy
+1 5
+5 0
+6 0
+SELECT * FROM t2 order by id;
+id xy
+1 5
+2 0
+5 1
+6 1
+DELETE FROM t1 WHERE id IN (SELECT id FROM t3 WHERE id = 5);
+SELECT * FROM t1 order by id;
+id xy
+1 5
+6 0
+SELECT * FROM t2 order by id;
+id xy
+1 5
+2 0
+5 1
+6 0
+INSERT INTO t1 VALUES (5,0);
+UPDATE t2 SET xy = 1 WHERE id = 6;
+TRUNCATE t4;
+INSERT INTO t4 SELECT * FROM t1;
+TRUNCATE t5;
+INSERT INTO t5 SELECT * FROM t2;
+SELECT * FROM t1 order by id;
+id xy
+1 5
+5 0
+6 0
+SELECT * FROM t2 order by id;
+id xy
+1 5
+2 0
+5 1
+6 1
+SELECT * FROM t4 order by id;
+id xy
+1 5
+5 0
+6 0
+SELECT * FROM t5 order by id;
+id xy
+1 5
+2 0
+5 1
+6 1
+DELETE FROM t1,t4 USING t1,t3,t4 WHERE t1.id IN (SELECT id FROM t3 WHERE id = 5) AND t4.id IN (SELECT id FROM t3 WHERE id = 5);
+SELECT * FROM t1 order by id;
+id xy
+1 5
+6 0
+SELECT * FROM t2 order by id;
+id xy
+1 5
+2 0
+5 1
+6 0
+SELECT * FROM t4 order by id;
+id xy
+1 5
+6 0
+SELECT * FROM t5 order by id;
+id xy
+1 5
+2 0
+5 1
+6 0
+INSERT INTO t1 VALUES (5, 0);
+REPLACE INTO t2 VALUES (6,1);
+SELECT * FROM t1 order by id;
+id xy
+1 5
+5 0
+6 0
+SELECT * FROM t2 order by id;
+id xy
+1 5
+2 0
+5 1
+6 1
+REPLACE INTO t1 VALUES (5, 1);
+SELECT * FROM t1 order by id;
+id xy
+1 5
+5 1
+6 0
+SELECT * FROM t2 order by id;
+id xy
+1 5
+2 0
+5 1
+6 0
+DROP TRIGGER t1_delete;
+DROP TRIGGER t4_delete;
+DROP TABLE t1, t2, t3, t4, t5;
End of 5.1 tests
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index 34d8e3ab768..c6e077b2857 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -51,3 +51,27 @@ SSL error: Unable to get private key from ''
mysqltest: Could not open connection 'default': 2026 SSL connection error
SSL error: Unable to get certificate from ''
mysqltest: Could not open connection 'default': 2026 SSL connection error
+Variable_name Value
+Ssl_cipher DHE-RSA-AES256-SHA
+End of 5.0 tests
+DROP TABLE IF EXISTS thread_status;
+DROP EVENT IF EXISTS event_status;
+SET GLOBAL event_scheduler=1;
+CREATE EVENT event_status
+ON SCHEDULE AT NOW()
+ON COMPLETION NOT PRESERVE
+DO
+BEGIN
+CREATE TABLE thread_status
+SELECT variable_name, variable_value
+FROM information_schema.session_status
+WHERE variable_name LIKE 'SSL_ACCEPTS' OR
+variable_name LIKE 'SSL_CALLBACK_CACHE_HITS';
+END$$
+SELECT variable_name, variable_value FROM thread_status;
+variable_name variable_value
+SSL_ACCEPTS 0.0000000
+SSL_CALLBACK_CACHE_HITS 0.0000000
+DROP TABLE thread_status;
+SET GLOBAL event_scheduler=0;
+End of 5.1 tests
diff --git a/mysql-test/r/openssl_2.result b/mysql-test/r/openssl_2.result
deleted file mode 100644
index 879c623dd40..00000000000
--- a/mysql-test/r/openssl_2.result
+++ /dev/null
@@ -1,25 +0,0 @@
-SHOW STATUS LIKE 'Ssl%';
-Variable_name Value
-Ssl_accepts 1
-Ssl_finished_accepts 1
-Ssl_finished_connects 0
-Ssl_accept_renegotiates 0
-Ssl_connect_renegotiates 0
-Ssl_callback_cache_hits 0
-Ssl_session_cache_hits 0
-Ssl_session_cache_misses 0
-Ssl_session_cache_timeouts 0
-Ssl_used_session_cache_entries 1
-Ssl_client_connects 0
-Ssl_session_cache_overflows 0
-Ssl_session_cache_size 128
-Ssl_session_cache_mode SERVER
-Ssl_sessions_reused 0
-Ssl_ctx_verify_mode 7
-Ssl_ctx_verify_depth 4294967295
-Ssl_verify_mode 7
-Ssl_verify_depth 4294967295
-Ssl_version TLSv1
-Ssl_cipher EDH-RSA-DES-CBC3-SHA
-Ssl_cipher_list
-Ssl_default_timeout 7200
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 8a19cfcded2..25fbeadf21b 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -906,6 +906,90 @@ ERROR 23000: Column 'val' in order clause is ambiguous
SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
ERROR 23000: Column 'val' in order clause is ambiguous
DROP TABLE t1;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (3), (2), (4), (1);
+SELECT a, IF(a IN (2,3), a, a+10) FROM t1
+ORDER BY IF(a IN (2,3), a, a+10);
+a IF(a IN (2,3), a, a+10)
+2 2
+3 3
+1 11
+4 14
+SELECT a, IF(a NOT IN (2,3), a, a+10) FROM t1
+ORDER BY IF(a NOT IN (2,3), a, a+10);
+a IF(a NOT IN (2,3), a, a+10)
+1 1
+4 4
+2 12
+3 13
+SELECT a, IF(a IN (2,3), a, a+10) FROM t1
+ORDER BY IF(a NOT IN (2,3), a, a+10);
+a IF(a IN (2,3), a, a+10)
+1 11
+4 14
+2 2
+3 3
+SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
+ORDER BY IF(a BETWEEN 2 AND 3, a, a+10);
+a IF(a BETWEEN 2 AND 3, a, a+10)
+2 2
+3 3
+1 11
+4 14
+SELECT a, IF(a NOT BETWEEN 2 AND 3, a, a+10) FROM t1
+ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
+a IF(a NOT BETWEEN 2 AND 3, a, a+10)
+1 1
+4 4
+2 12
+3 13
+SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
+ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
+a IF(a BETWEEN 2 AND 3, a, a+10)
+1 11
+4 14
+2 2
+3 3
+SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
+FROM t1 GROUP BY x1, x2;
+x1 x2
+ 3
+ 4
+1
+2
+SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
+FROM t1 GROUP BY x1, IF(a NOT IN (1,2), a, '');
+x1 x2
+ 3
+ 4
+1
+2
+SELECT a, a IN (1,2) FROM t1 ORDER BY a IN (1,2);
+a a IN (1,2)
+3 0
+4 0
+2 1
+1 1
+SELECT a FROM t1 ORDER BY a IN (1,2);
+a
+3
+4
+2
+1
+SELECT a+10 FROM t1 ORDER BY a IN (1,2);
+a+10
+13
+14
+12
+11
+SELECT a, IF(a IN (1,2), a, a+10) FROM t1
+ORDER BY IF(a IN (3,4), a, a+10);
+a IF(a IN (1,2), a, a+10)
+3 13
+4 14
+1 1
+2 2
+DROP TABLE t1;
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
@@ -958,6 +1042,28 @@ a ratio
19 1.3333
9 2.6667
drop table t1;
+CREATE TABLE t1 (a INT UNSIGNED NOT NULL, b TIME);
+INSERT INTO t1 (a) VALUES (100000), (0), (100), (1000000),(10000), (1000), (10);
+UPDATE t1 SET b = SEC_TO_TIME(a);
+SELECT a, b FROM t1 ORDER BY b DESC;
+a b
+1000000 277:46:40
+100000 27:46:40
+10000 02:46:40
+1000 00:16:40
+100 00:01:40
+10 00:00:10
+0 00:00:00
+SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC;
+a b
+1000000 277:46:40
+100000 27:46:40
+10000 02:46:40
+1000 00:16:40
+100 00:01:40
+10 00:00:10
+0 00:00:00
+DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE KEY b (b));
INSERT INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t2 (a INT, b INT, KEY a (a,b));
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index f7eda649dd2..2e5fa4b9195 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1219,4 +1219,23 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
id
22589
drop table t1, t2;
+set @org_mode=@@sql_mode;
+set @@sql_mode='NO_DIR_IN_CREATE';
+select @@sql_mode;
+@@sql_mode
+NO_DIR_IN_CREATE
+create table t1 (i int )
+partition by range (i)
+(
+partition p01 values less than (1000)
+data directory='/not/existing'
+ index directory='/not/existing'
+);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
+DROP TABLE t1, t2;
+set @@sql_mode=@org_mode;
End of 5.1 tests
diff --git a/mysql-test/r/partition_grant.result b/mysql-test/r/partition_grant.result
index e88427e5396..c334a473a2a 100644
--- a/mysql-test/r/partition_grant.result
+++ b/mysql-test/r/partition_grant.result
@@ -19,7 +19,16 @@ 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;
+create table t1 (s1 int);
+insert into t1 values (1);
+grant alter on mysqltest_1.* to mysqltest_1@localhost;
+alter table t1 partition by list (s1) (partition p1 values in (2));
+ERROR HY000: Table has no partition for some existing values
+grant select, alter on mysqltest_1.* to mysqltest_1@localhost;
+alter table t1 partition by list (s1) (partition p1 values in (2));
+ERROR HY000: Table has no partition for value 1
+drop table t1;
+drop user mysqltest_1@localhost;
drop schema mysqltest_1;
End of 5.1 tests
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 7b19492faec..15e1c8730f0 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1968,11 +1968,11 @@ 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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
call proc_1();
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
call proc_1();
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
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
@@ -1982,11 +1982,11 @@ 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
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
execute abc;
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
execute abc;
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
deallocate prepare abc;
drop procedure if exists a;
create procedure a() select 42;
@@ -2285,7 +2285,7 @@ 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
+ERROR HY000: Recursion 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;
@@ -2488,3 +2488,40 @@ execute stmt2 using @to_format, @dec;
format(?, ?)
10,000.00
deallocate prepare stmt2;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (i INT);
+INSERT INTO t2 VALUES (2);
+LOCK TABLE t1 READ, t2 WRITE;
+PREPARE stmt1 FROM "SELECT i FROM t1";
+PREPARE stmt2 FROM "INSERT INTO t2 (i) VALUES (3)";
+EXECUTE stmt1;
+i
+1
+EXECUTE stmt2;
+SELECT * FROM t2;
+i
+2
+UNLOCK TABLES;
+SELECT * FROM t2;
+i
+2
+3
+ALTER TABLE t1 ADD COLUMN j INT;
+ALTER TABLE t2 ADD COLUMN j INT;
+INSERT INTO t1 VALUES (4, 5);
+INSERT INTO t2 VALUES (4, 5);
+EXECUTE stmt1;
+i
+1
+4
+EXECUTE stmt2;
+SELECT * FROM t2;
+i j
+2 NULL
+3 NULL
+4 5
+3 NULL
+DROP TABLE t1, t2;
+End of 5.1 tests.
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index af7a762c5a8..d18bb8dc434 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -2961,20 +2961,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -3005,6 +3011,7 @@ Warning 1265 Data truncated for column 'c15' 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:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' 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
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 8c0b9f1e19b..e6ff668760c 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -2944,20 +2944,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -2988,6 +2994,7 @@ Warning 1265 Data truncated for column 'c15' 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:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' 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
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index 7ad6e3ea722..046992806cc 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -2945,20 +2945,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -2989,6 +2995,7 @@ Warning 1265 Data truncated for column 'c15' 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:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' 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
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index 1e2c27e6e4f..bbdb80df5d4 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -2881,20 +2881,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -2925,6 +2931,7 @@ Warning 1265 Data truncated for column 'c15' 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:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' 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
@@ -5895,20 +5902,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -5939,6 +5952,7 @@ Warning 1265 Data truncated for column 'c15' 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:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' 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
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
index e43f6b4ed6c..20d38ba84bd 100644
--- a/mysql-test/r/ps_7ndb.result
+++ b/mysql-test/r/ps_7ndb.result
@@ -2944,20 +2944,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -2988,6 +2994,7 @@ Warning 1265 Data truncated for column 'c15' 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:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' 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
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 49f70290d0e..866701d2204 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -1325,4 +1325,27 @@ start transaction;
insert into t1(c1) select c1 from v1;
drop table t1, t2, t3;
drop view v1;
+create table t1(c1 int);
+insert into t1 values(1),(10),(100);
+select * from t1;
+c1
+1
+10
+100
+select * from t1;
+c1
+1
+10
+100
+select * from t1;
+c1
+1
+10
+100
+select * from t1;
+c1
+1
+10
+100
+drop table t1;
set global query_cache_size=0;
diff --git a/mysql-test/r/query_cache_sql_prepare.result b/mysql-test/r/query_cache_sql_prepare.result
new file mode 100644
index 00000000000..64af5bc4ec2
--- /dev/null
+++ b/mysql-test/r/query_cache_sql_prepare.result
@@ -0,0 +1,204 @@
+set global query_cache_size=100000;
+flush status;
+create table t1(c1 int);
+insert into t1 values(1),(10),(100);
+prepare stmt1 from "select * from t1 where c1=10";
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 0
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 0
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 1
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 2
+prepare stmt2 from "select * from t1 where c1=10";
+execute stmt2;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 3
+execute stmt2;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 4
+execute stmt2;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 5
+prepare stmt3 from "select * from t1 where c1=10";
+execute stmt3;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 6
+execute stmt3;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 7
+execute stmt3;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 8
+select * from t1 where c1=10;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 9
+flush tables;
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 9
+select * from t1 where c1=10;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+prepare stmt1 from "select * from t1 where c1=?";
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+set @a=1;
+execute stmt1 using @a;
+c1
+1
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+set @a=100;
+execute stmt1 using @a;
+c1
+100
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+set @a=10;
+execute stmt1 using @a;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+prepare stmt1 from "select * from t1 where c1=10";
+set global query_cache_size=0;
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+set global query_cache_size=100000;
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 10
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 11
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 12
+set global query_cache_size=0;
+prepare stmt1 from "select * from t1 where c1=10";
+set global query_cache_size=100000;
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 12
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 12
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 12
+execute stmt1;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 12
+set global query_cache_size=0;
+prepare stmt1 from "select * from t1 where c1=?";
+set global query_cache_size=100000;
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 12
+set @a=1;
+execute stmt1 using @a;
+c1
+1
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 12
+set @a=100;
+execute stmt1 using @a;
+c1
+100
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 12
+set @a=10;
+execute stmt1 using @a;
+c1
+10
+show status like 'Qcache_hits';
+Variable_name Value
+Qcache_hits 12
+drop table t1;
+set global query_cache_size=0;
+flush status;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 5cd7e3ebfbd..d9efe21c5d0 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -717,6 +717,147 @@ d8c4177d225791924.30714720
d8c4177d2380fc201.39666693
d8c4177d24ccef970.14957924
DROP TABLE t1;
+create table t1 (
+c1 char(10), c2 char(10), c3 char(10), c4 char(10),
+c5 char(10), c6 char(10), c7 char(10), c8 char(10),
+c9 char(10), c10 char(10), c11 char(10), c12 char(10),
+c13 char(10), c14 char(10), c15 char(10), c16 char(10),
+index(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,c13,c14,c15,c16)
+);
+insert into t1 (c1) values ('1'),('1'),('1'),('1');
+select * from t1 where
+c1 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+and c2 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+and c3 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+and c4 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+and c5 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+and c6 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+and c7 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+and c8 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+and c9 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+"abcdefg1", "123456781", "qwertyui1", "asddfg1",
+"abcdefg2", "123456782", "qwertyui2", "asddfg2",
+"abcdefg3", "123456783", "qwertyui3", "asddfg3",
+"abcdefg4", "123456784", "qwertyui4", "asddfg4",
+"abcdefg5", "123456785", "qwertyui5", "asddfg5",
+"abcdefg6", "123456786", "qwertyui6", "asddfg6",
+"abcdefg7", "123456787", "qwertyui7", "asddfg7",
+"abcdefg8", "123456788", "qwertyui8", "asddfg8",
+"abcdefg9", "123456789", "qwertyui9", "asddfg9",
+"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
+drop table t1;
End of 4.1 tests
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 08d457f7ad7..e6dea211fdc 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -175,6 +175,24 @@ ROW(2,10) <=> ROW(3,4)
SELECT ROW(NULL,10) <=> ROW(3,NULL);
ROW(NULL,10) <=> ROW(3,NULL)
0
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1),ROW(1,ROW(2,3)));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,ROW(2,2,2)));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3,4)) IN (ROW(1,ROW(2,3,4)),ROW(1,ROW(2,2)));
+ERROR 21000: Operand should contain 3 column(s)
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1),ROW(1,ROW(2,4)));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3)) IN ((SELECT 1,1),ROW(1,ROW(2,3)));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
+ERROR 21000: Operand should contain 1 column(s)
+SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
+ERROR 21000: Operand should contain 1 column(s)
SELECT ROW(1,1,1) = ROW(1,1,1) as `1`, ROW(1,1,1) = ROW(1,2,1) as `0`, ROW(1,NULL,1) = ROW(2,2,1) as `0`, ROW(1,NULL,1) = ROW(1,2,2) as `0`, ROW(1,NULL,1) = ROW(1,2,1) as `null` ;
1 0 0 0 null
1 0 0 0 NULL
@@ -306,3 +324,16 @@ a b a b c
1 1 1 2 1
1 2 1 2 1
DROP TABLE t1,t2;
+CREATE TABLE t1(
+a int, b int, c int, d int, e int, f int, g int, h int,
+PRIMARY KEY (a,b,c,d,e,f,g)
+);
+INSERT INTO t1 VALUES (1,2,3,4,5,6,7,99);
+SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7);
+h
+99
+SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7));
+SELECT @x;
+@x
+99
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_000015.result b/mysql-test/r/rpl_000015.result
index a53750f82ad..8d23136420f 100644
--- a/mysql-test/r/rpl_000015.result
+++ b/mysql-test/r/rpl_000015.result
@@ -1,23 +1,23 @@
reset master;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 102
+master-bin.000001 106
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
+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 Master_SSL_Verify_Server_Cert
change master to master_host='127.0.0.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 test DEFAULT_MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 test DEFAULT_MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # No
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_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 MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # 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 7 master-bin.000001 102 # # master-bin.000001 Yes Yes 0 0 102 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # No
drop table if exists t1;
create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
diff --git a/mysql-test/r/rpl_change_master.result b/mysql-test/r/rpl_change_master.result
index 513de9494ba..680328bcea5 100644
--- a/mysql-test/r/rpl_change_master.result
+++ b/mysql-test/r/rpl_change_master.result
@@ -12,12 +12,12 @@ insert into t1 values(1);
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 # # # master-bin.000001 No No 0 0 187 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # 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 # # # master-bin.000001 No No 0 0 187 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No
start slave;
select * from t1;
n
diff --git a/mysql-test/r/rpl_critical_errors.result b/mysql-test/r/rpl_critical_errors.result
new file mode 100644
index 00000000000..bcc53565084
--- /dev/null
+++ b/mysql-test/r/rpl_critical_errors.result
@@ -0,0 +1 @@
+Turn on parsing to run this test
diff --git a/mysql-test/r/rpl_critical_errors.result.txt b/mysql-test/r/rpl_critical_errors.result.txt
new file mode 100644
index 00000000000..0df2e1ef369
--- /dev/null
+++ b/mysql-test/r/rpl_critical_errors.result.txt
@@ -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;
+CREATE TABLE t1 (data LONGBLOB) ENGINE=MYISAM;
+CREATE TABLE t2 (data LONGBLOB) ENGINE=MYISAM;
+INSERT INTO t1 (data) VALUES (repeat('a',1024*1024));
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t2 SELECT * FROM t1;
+KILL QUERY 2;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+0
+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 1317
+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 #
diff --git a/mysql-test/r/rpl_ddl.result b/mysql-test/r/rpl_ddl.result
index ace86532b12..d41462de621 100644
--- a/mysql-test/r/rpl_ddl.result
+++ b/mysql-test/r/rpl_ddl.result
@@ -4,45 +4,47 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+
+-------- switch to master -------
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="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 TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT);
+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) ENGINE=MEMORY;
SET AUTOCOMMIT = 0;
use mysqltest1;
-------- switch to slave --------
-SET AUTOCOMMIT = 0;
+SET AUTOCOMMIT = 1;
use mysqltest1;
-------- switch to master -------
-######## COMMIT ########
+######## SELECT 1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 0 + 1;
@@ -56,7 +58,9 @@ MAX(f1)
0
-------- switch to master -------
-COMMIT;
+SELECT 1;
+1
+1
SELECT MAX(f1) FROM t1;
MAX(f1)
1
@@ -64,32 +68,110 @@ MAX(f1)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
-1
+0
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
+0
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+
+######## SELECT COUNT(*) FROM t1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 0 + 1;
+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)
+0
+
+-------- switch to master -------
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
+0
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+
+######## COMMIT ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 0 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
1
-TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+-------- 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 -------
-flush logs;
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
-flush logs;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
-######## ROLLBACK ########
+######## ROLLBACK ########
-------- switch to master -------
INSERT INTO t1 SET f1= 1 + 1;
@@ -129,14 +211,8 @@ MAX(f1)
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 ########
+######## SET AUTOCOMMIT=1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 1 + 1;
@@ -176,15 +252,9 @@ MAX(f1)
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 ########
+######## START TRANSACTION ########
-------- switch to master -------
INSERT INTO t1 SET f1= 2 + 1;
@@ -224,14 +294,8 @@ MAX(f1)
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
-flush logs;
--------- switch to slave --------
-flush logs;
-
--------- switch to master -------
-
-######## BEGIN ########
+######## BEGIN ########
-------- switch to master -------
INSERT INTO t1 SET f1= 3 + 1;
@@ -271,14 +335,8 @@ MAX(f1)
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 ########
+######## DROP TABLE mysqltest1.t2 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 4 + 1;
@@ -318,12 +376,6 @@ MAX(f1)
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)
@@ -333,7 +385,7 @@ Tables_in_mysqltest1 (t2)
-------- switch to master -------
-######## DROP TEMPORARY TABLE mysqltest1.t23 ########
+######## DROP TEMPORARY TABLE mysqltest1.t23 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 5 + 1;
@@ -368,15 +420,9 @@ 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;
+5
--------- switch to slave --------
-flush logs;
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
-------- switch to master -------
SHOW TABLES LIKE 't23';
@@ -388,7 +434,7 @@ Tables_in_mysqltest1 (t23)
-------- switch to master -------
-######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ########
+######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 5 + 1;
@@ -399,7 +445,7 @@ MAX(f1)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
-6
+5
-------- switch to master -------
RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
@@ -428,12 +474,6 @@ MAX(f1)
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
@@ -445,7 +485,7 @@ t20
-------- switch to master -------
-######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ########
+######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ########
-------- switch to master -------
INSERT INTO t1 SET f1= 6 + 1;
@@ -485,12 +525,6 @@ MAX(f1)
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
@@ -504,7 +538,7 @@ f2 bigint(20) YES NULL
-------- switch to master -------
-######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB" ########
+######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= InnoDB ########
-------- switch to master -------
INSERT INTO t1 SET f1= 7 + 1;
@@ -518,7 +552,7 @@ MAX(f1)
7
-------- switch to master -------
-CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB";
+CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= InnoDB;
SELECT MAX(f1) FROM t1;
MAX(f1)
8
@@ -544,14 +578,8 @@ MAX(f1)
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) ########
+######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY ########
-------- switch to master -------
INSERT INTO t1 SET f1= 8 + 1;
@@ -565,7 +593,7 @@ MAX(f1)
8
-------- switch to master -------
-CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
+CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY;
SELECT MAX(f1) FROM t1;
MAX(f1)
9
@@ -586,19 +614,13 @@ 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;
+8
--------- switch to slave --------
-flush logs;
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
-------- switch to master -------
-######## TRUNCATE TABLE mysqltest1.t7 ########
+######## TRUNCATE TABLE mysqltest1.t7 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 8 + 1;
@@ -609,7 +631,7 @@ MAX(f1)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
-9
+8
-------- switch to master -------
TRUNCATE TABLE mysqltest1.t7;
@@ -638,20 +660,16 @@ MAX(f1)
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 ########
+######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ########
-------- switch to master -------
INSERT INTO t1 SET f1= 9 + 1;
@@ -691,15 +709,9 @@ MAX(f1)
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 ########
+######## UNLOCK TABLES ########
-------- switch to master -------
INSERT INTO t1 SET f1= 10 + 1;
@@ -739,15 +751,9 @@ MAX(f1)
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 ########
+######## UNLOCK TABLES ########
-------- switch to master -------
INSERT INTO t1 SET f1= 10 + 1;
@@ -788,15 +794,9 @@ MAX(f1)
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 ########
+######## UNLOCK TABLES ########
-------- switch to master -------
INSERT INTO t1 SET f1= 10 + 1;
@@ -836,14 +836,8 @@ MAX(f1)
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 ########
+######## DROP INDEX my_idx6 ON mysqltest1.t6 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 11 + 1;
@@ -883,12 +877,6 @@ MAX(f1)
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
@@ -898,7 +886,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
-------- switch to master -------
-######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ########
+######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ########
-------- switch to master -------
INSERT INTO t1 SET f1= 12 + 1;
@@ -938,12 +926,6 @@ MAX(f1)
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
@@ -955,7 +937,7 @@ t5 1 my_idx5 1 f1 A NULL NULL NULL YES BTREE
-------- switch to master -------
-######## DROP DATABASE mysqltest2 ########
+######## DROP DATABASE mysqltest2 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 13 + 1;
@@ -995,12 +977,6 @@ MAX(f1)
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)
@@ -1010,7 +986,7 @@ Database (mysqltest2)
-------- switch to master -------
-######## CREATE DATABASE mysqltest3 ########
+######## CREATE DATABASE mysqltest3 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 14 + 1;
@@ -1050,12 +1026,6 @@ MAX(f1)
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
@@ -1067,7 +1037,7 @@ mysqltest3
-------- switch to master -------
-######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ########
+######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ########
-------- switch to master -------
INSERT INTO t1 SET f1= 15 + 1;
@@ -1107,12 +1077,6 @@ MAX(f1)
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
@@ -1122,7 +1086,8 @@ Modified #
Created #
Security_type DEFINER
Comment
- -------- switch to slave -------
+
+-------- switch to slave --------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
@@ -1133,7 +1098,9 @@ Created #
Security_type DEFINER
Comment
-######## ALTER PROCEDURE p1 COMMENT "I have been altered" ########
+-------- switch to master -------
+
+######## ALTER PROCEDURE p1 COMMENT "I have been altered" ########
-------- switch to master -------
INSERT INTO t1 SET f1= 16 + 1;
@@ -1173,12 +1140,6 @@ MAX(f1)
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
@@ -1188,7 +1149,8 @@ Modified #
Created #
Security_type DEFINER
Comment I have been altered
- -------- switch to slave -------
+
+-------- switch to slave --------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
@@ -1199,7 +1161,9 @@ Created #
Security_type DEFINER
Comment I have been altered
-######## DROP PROCEDURE p1 ########
+-------- switch to master -------
+
+######## DROP PROCEDURE p1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 17 + 1;
@@ -1239,17 +1203,14 @@ MAX(f1)
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
-flush logs;
+SHOW PROCEDURE STATUS LIKE 'p1';
-------- switch to slave --------
-flush logs;
+SHOW PROCEDURE STATUS LIKE 'p1';
-------- 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 ########
+######## CREATE OR REPLACE VIEW v1 as select * from t1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 18 + 1;
@@ -1289,22 +1250,18 @@ MAX(f1)
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 -------
+-------- 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 -------
+
+######## ALTER VIEW v1 AS select f1 from t1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 19 + 1;
@@ -1344,22 +1301,18 @@ MAX(f1)
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 -------
+-------- 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 -------
+
+######## DROP VIEW IF EXISTS v1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 20 + 1;
@@ -1399,20 +1352,16 @@ MAX(f1)
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 -------
+-------- 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 -------
+
+######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 21 + 1;
@@ -1452,22 +1401,18 @@ MAX(f1)
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 -------
+-------- 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 -------
+
+######## DROP TRIGGER trg1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 22 + 1;
@@ -1507,20 +1452,16 @@ MAX(f1)
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 -------
+-------- switch to slave --------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
-######## CREATE USER user1@localhost ########
+-------- switch to master -------
+
+######## CREATE USER user1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 23 + 1;
@@ -1560,22 +1501,18 @@ MAX(f1)
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 -------
+-------- switch to slave --------
SELECT user FROM mysql.user WHERE user = 'user1';
user
user1
-######## RENAME USER user1@localhost TO rename1@localhost ########
+-------- switch to master -------
+
+######## RENAME USER user1@localhost TO rename1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 24 + 1;
@@ -1615,22 +1552,18 @@ MAX(f1)
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 -------
+-------- switch to slave --------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
rename1
-######## DROP USER rename1@localhost ########
+-------- switch to master -------
+
+######## DROP USER rename1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 25 + 1;
@@ -1670,18 +1603,14 @@ MAX(f1)
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 -------
+-------- 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;
+use test;
+
+-------- switch to master -------
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest3;
diff --git a/mysql-test/r/rpl_deadlock_innodb.result b/mysql-test/r/rpl_deadlock_innodb.result
index caf040c0997..914e1497094 100644
--- a/mysql-test/r/rpl_deadlock_innodb.result
+++ b/mysql-test/r/rpl_deadlock_innodb.result
@@ -78,9 +78,10 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
stop slave;
delete from t3;
-change master to master_log_pos=544;
+change master to master_log_pos=548;
begin;
select * from t2 for update;
a
@@ -132,11 +133,12 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
set @my_max_relay_log_size= @@global.max_relay_log_size;
set global max_relay_log_size=0;
stop slave;
delete from t3;
-change master to master_log_pos=544;
+change master to master_log_pos=548;
begin;
select * from t2 for update;
a
@@ -191,6 +193,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
drop table t1,t2,t3,t4;
set global max_relay_log_size= @my_max_relay_log_size;
End of 5.1 tests
diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result
index 3e234d4ef59..d57600d7396 100644
--- a/mysql-test/r/rpl_empty_master_crash.result
+++ b/mysql-test/r/rpl_empty_master_crash.result
@@ -5,7 +5,7 @@ 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
+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 Master_SSL_Verify_Server_Cert
load table t1 from master;
ERROR 08S01: Error connecting to master: Master is not configured
load table t1 from master;
diff --git a/mysql-test/r/rpl_events.result b/mysql-test/r/rpl_events.result
new file mode 100644
index 00000000000..bff1a814a6d
--- /dev/null
+++ b/mysql-test/r/rpl_events.result
@@ -0,0 +1,161 @@
+set global event_scheduler=1;
+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=row;
+DROP EVENT IF EXISTS test.justonce;
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
+`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+`c` VARCHAR(50) NOT NULL,
+`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 (c) VALUES ('manually');
+CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1
+(c) VALUES ('from justonce');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+db name status originator
+test justonce ENABLED 1
+"in the master"
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+id c ts
+1 manually TIMESTAMP
+2 from justonce TIMESTAMP
+affected rows: 2
+"in the slave"
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+id c ts
+1 manually TIMESTAMP
+2 from justonce TIMESTAMP
+affected rows: 2
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+db name status originator
+test justonce SLAVESIDE_DISABLED 1
+DROP EVENT IF EXISTS test.slave_once;
+CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
+INSERT INTO t1(c) VALUES ('from slave_once');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
+db name status originator
+test slave_once ENABLED 2
+DROP EVENT IF EXISTS test.slave_once;
+DROP EVENT IF EXISTS test.justonce;
+CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
+INSERT INTO t1(c) VALUES ('from er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er')
+"in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er')
+"in the master"
+ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er')
+"in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er')
+"in the master"
+DROP EVENT test.er;
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+db name status originator
+"in the slave"
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+db name status originator
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+db name status originator
+test slave_terminate ENABLED 2
+DROP EVENT test.slave_terminate;
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+db name status originator
+test slave_terminate SLAVESIDE_DISABLED 2
+DROP EVENT test.slave_terminate;
+"in the master"
+DROP TABLE t1;
+set binlog_format=statement;
+DROP EVENT IF EXISTS test.justonce;
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
+`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+`c` VARCHAR(50) NOT NULL,
+`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 (c) VALUES ('manually');
+CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1
+(c) VALUES ('from justonce');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+db name status originator
+test justonce ENABLED 1
+"in the master"
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+id c ts
+1 manually TIMESTAMP
+2 from justonce TIMESTAMP
+affected rows: 2
+"in the slave"
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+id c ts
+1 manually TIMESTAMP
+2 from justonce TIMESTAMP
+affected rows: 2
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+db name status originator
+test justonce SLAVESIDE_DISABLED 1
+DROP EVENT IF EXISTS test.slave_once;
+CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
+INSERT INTO t1(c) VALUES ('from slave_once');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
+db name status originator
+test slave_once ENABLED 2
+DROP EVENT IF EXISTS test.slave_once;
+DROP EVENT IF EXISTS test.justonce;
+CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
+INSERT INTO t1(c) VALUES ('from er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er')
+"in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er')
+"in the master"
+ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er')
+"in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er')
+"in the master"
+DROP EVENT test.er;
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+db name status originator
+"in the slave"
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+db name status originator
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+db name status originator
+test slave_terminate ENABLED 2
+DROP EVENT test.slave_terminate;
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+db name status originator
+test slave_terminate SLAVESIDE_DISABLED 2
+DROP EVENT test.slave_terminate;
+"in the master"
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_extraCol_innodb.result b/mysql-test/r/rpl_extraCol_innodb.result
index ff505364124..a237edc8063 100644
--- a/mysql-test/r/rpl_extraCol_innodb.result
+++ b/mysql-test/r/rpl_extraCol_innodb.result
@@ -87,6 +87,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t3 ***
@@ -144,6 +145,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t4 ***
@@ -201,6 +203,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t5 ***
@@ -257,6 +260,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -364,6 +368,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t10 ***
@@ -420,6 +425,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t11 ***
@@ -605,6 +611,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Try to insert in master ****
@@ -735,6 +742,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
** DROP table t17 ***
diff --git a/mysql-test/r/rpl_extraCol_myisam.result b/mysql-test/r/rpl_extraCol_myisam.result
index b5ccab8ff4c..95f99ba1014 100644
--- a/mysql-test/r/rpl_extraCol_myisam.result
+++ b/mysql-test/r/rpl_extraCol_myisam.result
@@ -87,6 +87,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t3 ***
@@ -144,6 +145,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t4 ***
@@ -201,6 +203,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t5 ***
@@ -257,6 +260,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -364,6 +368,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t10 ***
@@ -420,6 +425,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t11 ***
@@ -605,6 +611,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Try to insert in master ****
@@ -735,6 +742,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
** DROP table t17 ***
diff --git a/mysql-test/r/rpl_flushlog_loop.result b/mysql-test/r/rpl_flushlog_loop.result
index 16d8ba251f4..1e90796b2ea 100644
--- a/mysql-test/r/rpl_flushlog_loop.result
+++ b/mysql-test/r/rpl_flushlog_loop.result
@@ -24,7 +24,7 @@ Master_User root
Master_Port SLAVE_PORT
Connect_Retry 60
Master_Log_File slave-bin.000001
-Read_Master_Log_Pos 212
+Read_Master_Log_Pos 216
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File slave-bin.000001
@@ -39,7 +39,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 212
+Exec_Master_Log_Pos 216
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -51,3 +51,4 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
diff --git a/mysql-test/r/rpl_ignore_table.result b/mysql-test/r/rpl_ignore_table.result
index 136cf5cc5eb..e7200b31212 100644
--- a/mysql-test/r/rpl_ignore_table.result
+++ b/mysql-test/r/rpl_ignore_table.result
@@ -14,6 +14,114 @@ SELECT * FROM t4;
a
DROP TABLE t1;
DROP TABLE t4;
+**** Test case for BUG#25482 ****
+**** Adding GRANTS on master ****
+create table test.t1(a int);
+create table test.t4(a int);
+GRANT SELECT ON test.t1 TO mysqltest1@localhost;
+GRANT INSERT ON test.t4 TO mysqltest2@localhost;
+GRANT select, update, insert, references on t1
+to mysqltest2@localhost;
+GRANT SELECT ON test.* TO mysqltest3@localhost;
+GRANT INSERT ON test.t4 TO mysqltest3@localhost;
+GRANT select(a), update(a), insert(a), references(a) on t4
+to mysqltest3@localhost;
+create database mysqltest2;
+create table mysqltest2.t2 (id int);
+GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
+insert into mysql.user (user, host) values ("mysqltest5", "somehost");
+Warnings:
+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
+GRANT SELECT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON test.* TO mysqltest6@localhost;
+GRANT INSERT ON test.t1 TO mysqltest6@localhost;
+show grants for mysqltest1@localhost;
+Grants for mysqltest1@localhost
+GRANT USAGE ON *.* TO 'mysqltest1'@'localhost'
+GRANT SELECT ON `test`.`t1` TO 'mysqltest1'@'localhost'
+show grants for mysqltest2@localhost;
+Grants for mysqltest2@localhost
+GRANT USAGE ON *.* TO 'mysqltest2'@'localhost'
+GRANT SELECT, INSERT, UPDATE, REFERENCES ON `test`.`t1` TO 'mysqltest2'@'localhost'
+GRANT INSERT ON `test`.`t4` TO 'mysqltest2'@'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+GRANT SELECT ON `mysqltest2`.`t2` TO 'mysqltest4'@'localhost'
+show grants for mysqltest6@localhost;
+Grants for mysqltest6@localhost
+GRANT SELECT, INSERT ON *.* TO 'mysqltest6'@'localhost'
+GRANT INSERT ON `test`.* TO 'mysqltest6'@'localhost'
+GRANT INSERT ON `test`.`t1` TO 'mysqltest6'@'localhost'
+flush privileges;
+show grants for mysqltest5@somehost;
+Grants for mysqltest5@somehost
+GRANT USAGE ON *.* TO 'mysqltest5'@'somehost'
+**** Checking grants on slave ****
+show grants for mysqltest2@localhost;
+Grants for mysqltest2@localhost
+GRANT USAGE ON *.* TO 'mysqltest2'@'localhost'
+GRANT INSERT ON `test`.`t4` TO 'mysqltest2'@'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+GRANT SELECT ON `mysqltest2`.`t2` TO 'mysqltest4'@'localhost'
+show grants for mysqltest5@somehost;
+Grants for mysqltest5@somehost
+GRANT USAGE ON *.* TO 'mysqltest5'@'somehost'
+show grants for mysqltest6@localhost;
+Grants for mysqltest6@localhost
+GRANT SELECT, INSERT ON *.* TO 'mysqltest6'@'localhost'
+GRANT INSERT ON `test`.* TO 'mysqltest6'@'localhost'
+show grants for mysqltest1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost'
+**** Revoking grants on master ****
+REVOKE SELECT ON test.t1 FROM mysqltest1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost;
+REVOKE select(a) on t4
+from mysqltest3@localhost;
+show grants for mysqltest1@localhost;
+Grants for mysqltest1@localhost
+GRANT USAGE ON *.* TO 'mysqltest1'@'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+**** Checking grants on slave ****
+show grants for mysqltest1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+drop table t1, t4, mysqltest2.t2;
+drop database mysqltest2;
+delete from mysql.user where user like "mysqltest%";
+delete from mysql.db where user like "mysqltest%";
+delete from mysql.columns_priv where user like "mysqltest%";
+delete from mysql.tables_priv where user like "mysqltest%";
+delete from mysql.tables_priv where user like "mysqltest%";
DROP TABLE IF EXISTS t5;
CREATE TABLE t5 (
word varchar(50) collate utf8_unicode_ci NOT NULL default ''
diff --git a/mysql-test/r/rpl_incident.result b/mysql-test/r/rpl_incident.result
new file mode 100644
index 00000000000..aea35c5f477
--- /dev/null
+++ b/mysql-test/r/rpl_incident.result
@@ -0,0 +1,107 @@
+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);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM t1;
+a
+1
+2
+3
+REPLACE INTO t1 VALUES (4);
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+**** On Slave ****
+SELECT * FROM t1;
+a
+1
+2
+3
+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.000002
+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 1586
+Last_Error The incident LOST_EVENTS occured on the master. Message: <none>
+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 #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+START SLAVE;
+SELECT * FROM t1;
+a
+1
+2
+3
+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.000002
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000002
+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 #
+Master_SSL_Verify_Server_Cert No
+DROP TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_known_bugs_detection.result b/mysql-test/r/rpl_known_bugs_detection.result
index eabc6185780..318bc3d63e7 100644
--- a/mysql-test/r/rpl_known_bugs_detection.result
+++ b/mysql-test/r/rpl_known_bugs_detection.result
@@ -33,7 +33,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 1105
Last_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
Skip_Counter 0
-Exec_Master_Log_Pos 242
+Exec_Master_Log_Pos 246
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -45,6 +45,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SELECT * FROM t1;
a b
stop slave;
@@ -115,7 +116,7 @@ FROM t2
ON DUPLICATE KEY UPDATE
t1.field_3 = t2.field_c'
Skip_Counter 0
-Exec_Master_Log_Pos 1274
+Exec_Master_Log_Pos 1278
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -127,6 +128,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SELECT * FROM t1;
id field_1 field_2 field_3
drop table t1, t2;
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
index cae11e98caa..cabc20b7057 100644
--- a/mysql-test/r/rpl_loaddata.result
+++ b/mysql-test/r/rpl_loaddata.result
@@ -28,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 1276
+slave-bin.000001 1280
drop table t1;
drop table t2;
drop table t3;
@@ -38,8 +38,8 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
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 1793 # # master-bin.000001 Yes Yes # 0 0 1793 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1797 # # master-bin.000001 Yes Yes # 0 0 1797 # None 0 No # No
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@@ -48,8 +48,8 @@ stop slave;
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 1828 # # master-bin.000001 No No # 0 0 1828 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1832 # # master-bin.000001 No No # 0 0 1832 # None 0 No # No
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@@ -59,8 +59,8 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # No
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=MyISAM;
diff --git a/mysql-test/r/rpl_loaddata_s.result b/mysql-test/r/rpl_loaddata_s.result
index f0c79c81c15..4fc33eee20d 100644
--- a/mysql-test/r/rpl_loaddata_s.result
+++ b/mysql-test/r/rpl_loaddata_s.result
@@ -10,6 +10,6 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
select count(*) from test.t1;
count(*)
2
-show binlog events from 102;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
drop table test.t1;
diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result
index c7484022b23..28ddbaf33a0 100644
--- a/mysql-test/r/rpl_log_pos.result
+++ b/mysql-test/r/rpl_log_pos.result
@@ -6,37 +6,37 @@ 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 102 <Binlog_Ignore_DB>
+master-bin.000001 106 <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 102 # # master-bin.000001 Yes Yes 0 0 102 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # No
stop slave;
-change master to master_log_pos=74;
+change master to master_log_pos=75;
start slave;
stop slave;
-change master to master_log_pos=74;
+change master to master_log_pos=75;
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 74 # # master-bin.000001 No No 0 0 74 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 75 # # master-bin.000001 No No 0 0 75 # None 0 No # 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 74 # # master-bin.000001 No Yes 0 0 74 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 75 # # master-bin.000001 No Yes 0 0 75 # None 0 No # No
stop slave;
-change master to master_log_pos=177;
+change master to master_log_pos=178;
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 177 # # master-bin.000001 No Yes 0 0 177 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 # Yes 0 0 178 # None 0 No # No
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 102 <Binlog_Ignore_DB>
+master-bin.000001 106 <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=102;
+change master to master_log_pos=106;
start slave;
select * from t1 ORDER BY n;
n
diff --git a/mysql-test/r/rpl_ndb_basic.result b/mysql-test/r/rpl_ndb_basic.result
index d6a9cdd4102..4dab05b31de 100644
--- a/mysql-test/r/rpl_ndb_basic.result
+++ b/mysql-test/r/rpl_ndb_basic.result
@@ -24,6 +24,33 @@ nid nom prenom
select * from t1 order by nid;
nid nom prenom
1 XYZ2 ABC2
+delete from t1;
+insert into t1 values(1,"AA", "AA");
+insert into t1 values(2,"BB", "BB");
+insert into t1 values(3,"CC", "CC");
+insert into t1 values(4,"DD", "DD");
+begin;
+delete from t1 where nid = 1;
+insert into t1 values (1,"A2", "A2");
+update t1 set nom="B2" where nid = 2;
+delete from t1 where nid = 2;
+update t1 set nom = "D2" where nid = 4;
+delete from t1 where nid = 4;
+insert into t1 values (4, "D3", "D3");
+update t1 set nom = "D4" where nid = 4;
+insert into t1 values (5, "EE", "EE");
+delete from t1 where nid = 5;
+commit;
+select * from t1 order by 1;
+nid nom prenom
+1 A2 A2
+3 CC CC
+4 D4 D3
+select * from t1 order by 1;
+nid nom prenom
+1 A2 A2
+3 CC CC
+4 D4 D3
DROP table t1;
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL,
@@ -65,6 +92,41 @@ nid nom prenom
4 CCP DDD
5 EEE FFF
DROP table t1;
+CREATE TABLE `t1` (
+`prid` int(10) unsigned NOT NULL,
+`id_type` enum('IMSI','SIP') NOT NULL,
+`fkimssub` varchar(50) NOT NULL,
+`user_id` varchar(20) DEFAULT NULL,
+`password` varchar(20) DEFAULT NULL,
+`ptg_nbr` varchar(20) DEFAULT NULL,
+`old_tmsi` int(10) unsigned DEFAULT NULL,
+`new_tmsi` int(10) unsigned DEFAULT NULL,
+`dev_capability` int(10) unsigned DEFAULT NULL,
+`dev_oid` bigint(20) unsigned DEFAULT NULL,
+`lac_cell_id` bigint(20) unsigned DEFAULT NULL,
+`ms_classmark1` int(10) unsigned DEFAULT NULL,
+`cipher_key` int(10) unsigned DEFAULT NULL,
+`priid_master` int(10) unsigned DEFAULT NULL,
+PRIMARY KEY (`prid`),
+UNIQUE KEY `fkimssub` (`fkimssub`,`ptg_nbr`) USING HASH
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1121 Ndb does not support unique index on NULL valued attributes, index access with NULL value will become full table scan
+INSERT INTO `t1` VALUES (183342,'IMSI','config3_sub_2Privates_3Publics_imssub_36668','user_id_73336','user_id_73336','73336',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(47617,'IMSI','config3_sub_2Privates_3Publics_imssub_9523','user_id_19046','user_id_19046','19046',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(200332,'IMSI','config3_sub_2Privates_3Publics_imssub_40066','user_id_80132','user_id_80132','80132',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(478882,'IMSI','config3_sub_2Privates_3Publics_imssub_95776','user_id_191552','user_id_191552','191552',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(490146,'IMSI','config3_sub_2Privates_3Publics_imssub_98029','user_id_196057','user_id_196057','196057',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(499301,'IMSI','config3_sub_2Privates_3Publics_imssub_99860','user_id_199719','user_id_199719','199719',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(506101,'IMSI','config3_sub_2Privates_3Publics_imssub_101220','user_id_202439','user_id_202439','202439',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(510142,'IMSI','config3_sub_2Privates_3Publics_imssub_102028','user_id_204056','user_id_204056','204056',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(515871,'IMSI','config3_sub_2Privates_3Publics_imssub_103174','user_id_206347','user_id_206347','206347',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(209842,'IMSI','config3_sub_2Privates_3Publics_imssub_41968','user_id_83936','user_id_83936','83936',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(365902,'IMSI','config3_sub_2Privates_3Publics_imssub_73180','user_id_146360','user_id_146360','146360',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(11892,'IMSI','config3_sub_2Privates_3Publics_imssub_2378','user_id_4756','user_id_4756','4756',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL);
+select count(*) from t1;
+count(*)
+12
+select count(*) from t1;
+count(*)
+12
+update t1 set dev_oid=dev_oid+1;
+select count(*) from t1;
+count(*)
+12
+select count(*) from t1;
+count(*)
+12
+DROP table t1;
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL,
`prenom` char(4) default NULL,
@@ -112,6 +174,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master <Seconds_Behind_Master>
+Master_SSL_Verify_Server_Cert No
set GLOBAL slave_transaction_retries=10;
START SLAVE;
select * from t1 order by nid;
diff --git a/mysql-test/r/rpl_ndb_charset.result b/mysql-test/r/rpl_ndb_charset.result
index 0ce4446c8a5..ed9b3cfbfa8 100644
--- a/mysql-test/r/rpl_ndb_charset.result
+++ b/mysql-test/r/rpl_ndb_charset.result
@@ -109,39 +109,39 @@ a b
1 cp850_general_ci
drop database mysqltest2;
drop database mysqltest3;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # drop database if exists mysqltest2
+master-bin.000001 # Query # # drop database if exists mysqltest3
+master-bin.000001 # Query # # create database mysqltest2 character set latin2
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # drop database mysqltest3
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # drop database mysqltest2
+master-bin.000001 # Query # # drop database mysqltest3
select "--- --global--" as "";
--- --global--
diff --git a/mysql-test/r/rpl_ndb_circular.result b/mysql-test/r/rpl_ndb_circular.result
new file mode 100644
index 00000000000..88516b757df
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_circular.result
@@ -0,0 +1,95 @@
+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;
+RESET MASTER;
+CHANGE MASTER TO master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root";
+START SLAVE;
+CREATE TABLE t1 (a int key, b int) ENGINE=ndb;
+SHOW TABLES;
+Tables_in_test
+t1
+INSERT INTO t1 VALUES (1,2);
+INSERT INTO t1 VALUES (2,3);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 2
+2 3
+show slave status;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+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 #
+Master_SSL_Verify_Server_Cert No
+SELECT * FROM t1 ORDER BY a;
+a b
+1 2
+2 3
+show slave status;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port #
+Connect_Retry 60
+Master_Log_File slave-bin.000001
+Read_Master_Log_Pos #
+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 #
+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 #
+Master_SSL_Verify_Server_Cert No
+STOP SLAVE;
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_ndb_circular_simplex.result b/mysql-test/r/rpl_ndb_circular_simplex.result
new file mode 100644
index 00000000000..ee452f345f9
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_circular_simplex.result
@@ -0,0 +1,97 @@
+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 key, b int) ENGINE=NDB;
+SHOW TABLES;
+Tables_in_test
+t1
+RESET MASTER;
+INSERT INTO t1 VALUES (1,2);
+INSERT INTO t1 VALUES (2,3);
+STOP SLAVE;
+CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=SLAVE_PORT,MASTER_USER="root";
+RESET MASTER;
+START SLAVE;
+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 #
+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 #
+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 #
+Master_SSL_Verify_Server_Cert No
+SELECT * FROM t1 ORDER BY a;
+a b
+1 2
+2 3
+STOP SLAVE;
+START SLAVE;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 2
+2 3
+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 #
+Master_SSL_Verify_Server_Cert No
diff --git a/mysql-test/r/rpl_ndb_dd_basic.result b/mysql-test/r/rpl_ndb_dd_basic.result
index 245be1cc0a9..f1cc6e9af24 100644
--- a/mysql-test/r/rpl_ndb_dd_basic.result
+++ b/mysql-test/r/rpl_ndb_dd_basic.result
@@ -34,33 +34,33 @@ 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
+master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001 # Query 1 # 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
+master-bin.000001 # Query 1 # alter logfile group lg1
add undofile 'undofile02.dat'
initial_size 4M engine=ndb
-master-bin.000001 # Query # # CREATE TABLESPACE ts1
+master-bin.000001 # Query 1 # CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB
-master-bin.000001 # Query # # alter tablespace ts1
+master-bin.000001 # Query 1 # alter tablespace ts1
add datafile 'datafile02.dat'
initial_size 4M engine=ndb
-master-bin.000001 # Query # # use `test`; CREATE TABLE t1
+master-bin.000001 # Query 1 # 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: # (mysql.ndb_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 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_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
drop table t1;
alter tablespace ts1
drop datafile 'datafile.dat'
diff --git a/mysql-test/r/rpl_ndb_ddl.result b/mysql-test/r/rpl_ndb_ddl.result
index f5d8073be94..aeaca1e7de0 100644
--- a/mysql-test/r/rpl_ndb_ddl.result
+++ b/mysql-test/r/rpl_ndb_ddl.result
@@ -4,45 +4,47 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+
+-------- switch to master -------
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";
+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 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";
+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);
+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) ENGINE=MEMORY;
SET AUTOCOMMIT = 0;
use mysqltest1;
-------- switch to slave --------
-SET AUTOCOMMIT = 0;
+SET AUTOCOMMIT = 1;
use mysqltest1;
-------- switch to master -------
-######## COMMIT ########
+######## SELECT 1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 0 + 1;
@@ -56,7 +58,9 @@ MAX(f1)
0
-------- switch to master -------
-COMMIT;
+SELECT 1;
+1
+1
SELECT MAX(f1) FROM t1;
MAX(f1)
1
@@ -64,32 +68,110 @@ MAX(f1)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
-1
+0
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
+0
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+
+######## SELECT COUNT(*) FROM t1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 0 + 1;
+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)
+0
+
+-------- switch to master -------
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
+0
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+
+######## COMMIT ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 0 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
1
-TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
-------- switch to master -------
-flush logs;
+COMMIT;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
-------- switch to slave --------
-flush logs;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
-######## ROLLBACK ########
+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 -------
+
+######## ROLLBACK ########
-------- switch to master -------
INSERT INTO t1 SET f1= 1 + 1;
@@ -129,14 +211,8 @@ MAX(f1)
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 ########
+######## SET AUTOCOMMIT=1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 1 + 1;
@@ -176,15 +252,9 @@ MAX(f1)
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 ########
+######## START TRANSACTION ########
-------- switch to master -------
INSERT INTO t1 SET f1= 2 + 1;
@@ -224,14 +294,8 @@ MAX(f1)
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
-flush logs;
-
--------- switch to slave --------
-flush logs;
-
--------- switch to master -------
-######## BEGIN ########
+######## BEGIN ########
-------- switch to master -------
INSERT INTO t1 SET f1= 3 + 1;
@@ -271,14 +335,8 @@ MAX(f1)
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 ########
+######## DROP TABLE mysqltest1.t2 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 4 + 1;
@@ -318,12 +376,6 @@ MAX(f1)
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)
@@ -333,7 +385,7 @@ Tables_in_mysqltest1 (t2)
-------- switch to master -------
-######## DROP TEMPORARY TABLE mysqltest1.t23 ########
+######## DROP TEMPORARY TABLE mysqltest1.t23 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 5 + 1;
@@ -373,12 +425,6 @@ MAX(f1)
TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
-------- switch to master -------
-flush logs;
-
--------- switch to slave --------
-flush logs;
-
--------- switch to master -------
SHOW TABLES LIKE 't23';
Tables_in_mysqltest1 (t23)
@@ -388,7 +434,7 @@ Tables_in_mysqltest1 (t23)
-------- switch to master -------
-######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ########
+######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 5 + 1;
@@ -428,12 +474,6 @@ MAX(f1)
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
@@ -445,7 +485,7 @@ t20
-------- switch to master -------
-######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ########
+######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ########
-------- switch to master -------
INSERT INTO t1 SET f1= 6 + 1;
@@ -485,12 +525,6 @@ MAX(f1)
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
@@ -504,7 +538,7 @@ f2 bigint(20) YES NULL
-------- switch to master -------
-######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "NDB" ########
+######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= NDB ########
-------- switch to master -------
INSERT INTO t1 SET f1= 7 + 1;
@@ -518,7 +552,7 @@ MAX(f1)
7
-------- switch to master -------
-CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "NDB";
+CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= NDB;
SELECT MAX(f1) FROM t1;
MAX(f1)
8
@@ -544,14 +578,8 @@ MAX(f1)
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) ########
+######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY ########
-------- switch to master -------
INSERT INTO t1 SET f1= 8 + 1;
@@ -565,7 +593,7 @@ MAX(f1)
8
-------- switch to master -------
-CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
+CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY;
SELECT MAX(f1) FROM t1;
MAX(f1)
9
@@ -591,14 +619,8 @@ MAX(f1)
TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
-------- switch to master -------
-flush logs;
-
--------- switch to slave --------
-flush logs;
-
--------- switch to master -------
-######## TRUNCATE TABLE mysqltest1.t7 ########
+######## TRUNCATE TABLE mysqltest1.t7 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 8 + 1;
@@ -638,20 +660,16 @@ MAX(f1)
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 ########
+######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ########
-------- switch to master -------
INSERT INTO t1 SET f1= 9 + 1;
@@ -691,15 +709,9 @@ MAX(f1)
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 ########
+######## UNLOCK TABLES ########
-------- switch to master -------
INSERT INTO t1 SET f1= 10 + 1;
@@ -739,15 +751,9 @@ MAX(f1)
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 ########
+######## UNLOCK TABLES ########
-------- switch to master -------
INSERT INTO t1 SET f1= 10 + 1;
@@ -788,15 +794,9 @@ MAX(f1)
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 ########
+######## UNLOCK TABLES ########
-------- switch to master -------
INSERT INTO t1 SET f1= 10 + 1;
@@ -836,14 +836,8 @@ MAX(f1)
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 ########
+######## DROP INDEX my_idx6 ON mysqltest1.t6 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 11 + 1;
@@ -883,12 +877,6 @@ MAX(f1)
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
@@ -898,7 +886,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
-------- switch to master -------
-######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ########
+######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ########
-------- switch to master -------
INSERT INTO t1 SET f1= 12 + 1;
@@ -938,12 +926,6 @@ MAX(f1)
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
@@ -955,7 +937,7 @@ t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE
-------- switch to master -------
-######## DROP DATABASE mysqltest2 ########
+######## DROP DATABASE mysqltest2 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 13 + 1;
@@ -995,12 +977,6 @@ MAX(f1)
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)
@@ -1010,7 +986,7 @@ Database (mysqltest2)
-------- switch to master -------
-######## CREATE DATABASE mysqltest3 ########
+######## CREATE DATABASE mysqltest3 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 14 + 1;
@@ -1050,12 +1026,6 @@ MAX(f1)
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
@@ -1067,7 +1037,7 @@ mysqltest3
-------- switch to master -------
-######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ########
+######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ########
-------- switch to master -------
INSERT INTO t1 SET f1= 15 + 1;
@@ -1107,12 +1077,6 @@ MAX(f1)
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
@@ -1122,7 +1086,8 @@ Modified #
Created #
Security_type DEFINER
Comment
- -------- switch to slave -------
+
+-------- switch to slave --------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
@@ -1133,7 +1098,9 @@ Created #
Security_type DEFINER
Comment
-######## ALTER PROCEDURE p1 COMMENT "I have been altered" ########
+-------- switch to master -------
+
+######## ALTER PROCEDURE p1 COMMENT "I have been altered" ########
-------- switch to master -------
INSERT INTO t1 SET f1= 16 + 1;
@@ -1173,12 +1140,6 @@ MAX(f1)
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
@@ -1188,7 +1149,8 @@ Modified #
Created #
Security_type DEFINER
Comment I have been altered
- -------- switch to slave -------
+
+-------- switch to slave --------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
@@ -1199,7 +1161,9 @@ Created #
Security_type DEFINER
Comment I have been altered
-######## DROP PROCEDURE p1 ########
+-------- switch to master -------
+
+######## DROP PROCEDURE p1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 17 + 1;
@@ -1239,17 +1203,14 @@ MAX(f1)
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
-flush logs;
+SHOW PROCEDURE STATUS LIKE 'p1';
-------- switch to slave --------
-flush logs;
+SHOW PROCEDURE STATUS LIKE 'p1';
-------- 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 ########
+######## CREATE OR REPLACE VIEW v1 as select * from t1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 18 + 1;
@@ -1289,22 +1250,18 @@ MAX(f1)
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 -------
+-------- 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 -------
+
+######## ALTER VIEW v1 AS select f1 from t1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 19 + 1;
@@ -1344,22 +1301,18 @@ MAX(f1)
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 -------
+-------- 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 -------
+
+######## DROP VIEW IF EXISTS v1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 20 + 1;
@@ -1399,20 +1352,16 @@ MAX(f1)
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 -------
+-------- 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 -------
+
+######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 21 + 1;
@@ -1452,22 +1401,18 @@ MAX(f1)
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 -------
+-------- 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 -------
+
+######## DROP TRIGGER trg1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 22 + 1;
@@ -1507,20 +1452,16 @@ MAX(f1)
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 -------
+-------- switch to slave --------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
-######## CREATE USER user1@localhost ########
+-------- switch to master -------
+
+######## CREATE USER user1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 23 + 1;
@@ -1560,22 +1501,18 @@ MAX(f1)
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 -------
+-------- switch to slave --------
SELECT user FROM mysql.user WHERE user = 'user1';
user
user1
-######## RENAME USER user1@localhost TO rename1@localhost ########
+-------- switch to master -------
+
+######## RENAME USER user1@localhost TO rename1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 24 + 1;
@@ -1615,22 +1552,18 @@ MAX(f1)
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 -------
+-------- switch to slave --------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
rename1
-######## DROP USER rename1@localhost ########
+-------- switch to master -------
+
+######## DROP USER rename1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 25 + 1;
@@ -1670,19 +1603,14 @@ MAX(f1)
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 -------
+-------- 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;
-ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+use test;
+
+-------- switch to master -------
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest3;
diff --git a/mysql-test/r/rpl_ndb_do_table.result b/mysql-test/r/rpl_ndb_do_table.result
index a5854985352..dda2844f6d0 100644
--- a/mysql-test/r/rpl_ndb_do_table.result
+++ b/mysql-test/r/rpl_ndb_do_table.result
@@ -19,4 +19,8 @@ t1
SELECT COUNT(*) FROM t1;
COUNT(*)
3
+INSERT INTO t1 VALUES (3, repeat('bad',1));
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
+INSERT INTO t1 VALUES (3, repeat('bad too',1));
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
DROP TABLE IF EXISTS t1, t2;
diff --git a/mysql-test/r/rpl_ndb_extraCol.result b/mysql-test/r/rpl_ndb_extraCol.result
index bc40e24ecac..8f6dae7c5b5 100644
--- a/mysql-test/r/rpl_ndb_extraCol.result
+++ b/mysql-test/r/rpl_ndb_extraCol.result
@@ -28,9 +28,9 @@ a b c
*** Select from slave ***
SELECT * FROM t1 ORDER BY a;
a b c d e
-1 2 TEXAS 2 TEST
-2 1 AUSTIN 2 TEST
-3 4 QA 2 TEST
+1 2 TEXAS NULL NULL
+2 1 AUSTIN NULL NULL
+3 4 QA NULL NULL
*** Drop t1 ***
DROP TABLE t1;
*** Create t3 on slave ***
@@ -87,6 +87,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t3 ***
@@ -144,6 +145,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t4 ***
@@ -201,6 +203,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t5 ***
@@ -257,6 +260,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -289,9 +293,9 @@ a b c
*** Select from slave ***
SELECT * FROM t7 ORDER BY a;
a b c d e
-1 b1b1 Kyle 0000-00-00 00:00:00 Extra Column Testing
-2 b1b1 JOE 0000-00-00 00:00:00 Extra Column Testing
-3 b1b1 QA 0000-00-00 00:00:00 Extra Column Testing
+1 b1b1 Kyle NULL NULL
+2 b1b1 JOE NULL NULL
+3 b1b1 QA NULL NULL
*** Drop t7 ***
DROP TABLE t7;
*** Create t8 on slave ***
@@ -364,6 +368,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t10 ***
@@ -420,6 +425,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t11 ***
@@ -447,9 +453,9 @@ a b c
*** Select on Slave ***
SELECT * FROM t12 ORDER BY a;
a b f c e
-1 b1b1b1b1b1b1b1b1 Kyle test 1
-2 b1b1b1b1b1b1b1b1 JOE test 1
-3 b1b1b1b1b1b1b1b1 QA test 1
+1 b1b1b1b1b1b1b1b1 Kyle NULL NULL
+2 b1b1b1b1b1b1b1b1 JOE NULL NULL
+3 b1b1b1b1b1b1b1b1 QA NULL NULL
*** Drop t12 ***
DROP TABLE t12;
**** Extra Colums End ****
@@ -479,9 +485,9 @@ a b c
*** Select on Slave ****
SELECT * FROM t13 ORDER BY a;
a b c d e
-1 b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
-2 b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
-3 b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+1 b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP
+2 b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP
+3 b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP
*** Drop t13 ***
DROP TABLE t13;
*** 22117 END ***
@@ -515,9 +521,9 @@ c1 c2 c3 c4 c5
*** Select on Slave ****
SELECT * FROM t14 ORDER BY c1;
c1 c2 c3 c4 c5 c6 c7
-1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
-2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
-3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP
*** connect to master and drop columns ***
ALTER TABLE t14 DROP COLUMN c2;
ALTER TABLE t14 DROP COLUMN c4;
@@ -530,9 +536,9 @@ c1 c3 c5
*** Select from Slave ***
SELECT * FROM t14 ORDER BY c1;
c1 c3 c5 c6 c7
-1 Replication Testing Extra Col Kyle 1 CURRENT_TIMESTAMP
-2 This Test Should work JOE 1 CURRENT_TIMESTAMP
-3 If is does not, I will open a bug QA 1 CURRENT_TIMESTAMP
+1 Replication Testing Extra Col Kyle NULL CURRENT_TIMESTAMP
+2 This Test Should work JOE NULL CURRENT_TIMESTAMP
+3 If is does not, I will open a bug QA NULL CURRENT_TIMESTAMP
*** Drop t14 ***
DROP TABLE t14;
*** Create t15 on slave ***
@@ -563,9 +569,9 @@ c1 c2 c3 c4 c5
*** Select on Slave ****
SELECT * FROM t15 ORDER BY c1;
c1 c2 c3 c4 c5 c6 c7
-1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
-2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
-3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP
*** Add column on master that is a Extra on Slave ***
ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
********************************************
@@ -605,6 +611,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Try to insert in master ****
@@ -618,9 +625,9 @@ c1 c2 c3 c4 c5 c6
*** Try to select from slave ****
SELECT * FROM t15 ORDER BY c1;
c1 c2 c3 c4 c5 c6 c7
-1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
-2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
-3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP
5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2 CURRENT_TIMESTAMP
*** DROP TABLE t15 ***
DROP TABLE t15;
@@ -652,9 +659,9 @@ c1 c2 c3 c4 c5
*** Select on Slave ****
SELECT * FROM t16 ORDER BY c1;
c1 c2 c3 c4 c5 c6 c7
-1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
-2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
-3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP
*** Add Partition on master ***
ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4;
INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer');
@@ -736,6 +743,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
** DROP table t17 ***
diff --git a/mysql-test/r/rpl_ndb_idempotent.result b/mysql-test/r/rpl_ndb_idempotent.result
index 982cab33482..2f2273c145e 100644
--- a/mysql-test/r/rpl_ndb_idempotent.result
+++ b/mysql-test/r/rpl_ndb_idempotent.result
@@ -33,15 +33,15 @@ 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>
+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 Master_SSL_Verify_Server_Cert
+<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> No
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>
+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 Master_SSL_Verify_Server_Cert
+<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> No
START SLAVE;
SELECT * FROM t1 ORDER BY c3;
c1 c2 c3
@@ -68,6 +68,6 @@ 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>
+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 Master_SSL_Verify_Server_Cert
+<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> No
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result
index 543af3b9abe..db2ce27d43b 100644
--- a/mysql-test/r/rpl_ndb_log.result
+++ b/mysql-test/r/rpl_ndb_log.result
@@ -32,16 +32,17 @@ master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
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 # COMMIT
-show binlog events from 102 limit 1;
+show binlog events from 106 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;
+show binlog events from 106 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;
+show binlog events from 106 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;
@@ -55,25 +56,25 @@ flush logs;
stop slave;
create table t2 (n int)ENGINE=NDB;
insert into t2 values (1);
-show binlog events;
+show binlog events from <binlog_start>;
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: # (mysql.ndb_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: # (mysql.ndb_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
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (mysql.ndb_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 t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+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 # Rotate # # 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
@@ -87,13 +88,13 @@ 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 1702
-master-bin.000002 593
+master-bin.000001 1775
+master-bin.000002 617
start slave;
show binary logs;
Log_name File_size
-slave-bin.000001 1797
-slave-bin.000002 198
+slave-bin.000001 1870
+slave-bin.000002 202
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
@@ -102,7 +103,7 @@ slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_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 # Write_rows 1 # 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
@@ -110,7 +111,8 @@ slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_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 # Write_rows 1 # table_id: #
+slave-bin.000001 # Write_rows 1 # 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
@@ -122,11 +124,11 @@ slave-bin.000002 # Query 2 # BEGIN
slave-bin.000002 # Table_map 2 # table_id: # (test.t2)
slave-bin.000002 # Table_map 2 # table_id: # (mysql.ndb_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 # Write_rows 1 # 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 593 # # master-bin.000002 Yes Yes # 0 0 593 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 617 # # master-bin.000002 Yes Yes # 0 0 617 # None 0 No # 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;
@@ -137,11 +139,10 @@ 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;
+show binlog events from <binlog_start>;
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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
select * from t1;
a b
1 1
diff --git a/mysql-test/r/rpl_ndb_multi.result b/mysql-test/r/rpl_ndb_multi.result
index 66819c2c9c8..760114f3639 100644
--- a/mysql-test/r/rpl_ndb_multi.result
+++ b/mysql-test/r/rpl_ndb_multi.result
@@ -26,11 +26,11 @@ stop slave;
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-102 master-bin1.000001
+106 master-bin1.000001
CHANGE MASTER TO
master_port=<MASTER_PORT1>,
master_log_file = 'master-bin1.000001',
-master_log_pos = 102 ;
+master_log_pos = 106 ;
start slave;
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
DELETE FROM t1 WHERE c3 = 1;
diff --git a/mysql-test/r/rpl_ndb_stm_innodb.result b/mysql-test/r/rpl_ndb_stm_innodb.result
new file mode 100644
index 00000000000..9ed54a11c1c
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_stm_innodb.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;
+create table t1 (a int key, b int) engine innodb;
+create table t2 (a int key, b int) engine innodb;
+alter table t1 engine ndb;
+alter table t2 engine ndb;
+insert into t1 values (1,2);
+select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status;
+@start_pos:=start_pos @end_pos:=end_pos
+<start_pos> <end_pos>
+show binlog events from <start_pos> limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 <start_pos> Query 1 # use `test`; insert into t1 values (1,2)
+show binlog events from <start_pos> limit 1,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Xid 1 445 COMMIT /* XID */
+begin;
+insert into t1 values (2,3);
+insert into t2 values (3,4);
+commit;
+select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status;
+@start_pos:=start_pos @end_pos:=end_pos
+<start_pos> <end_pos>
+show binlog events from <start_pos> limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 <start_pos> Query 1 # use `test`; BEGIN
+show binlog events from <start_pos> limit 1,2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; insert into t1 values (2,3)
+master-bin.000001 # Query # # use `test`; insert into t2 values (3,4)
+show binlog events from <start_pos> limit 3,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
diff --git a/mysql-test/r/rpl_ndb_sync.result b/mysql-test/r/rpl_ndb_sync.result
index 2b9ca24fca0..f2797eaa623 100644
--- a/mysql-test/r/rpl_ndb_sync.result
+++ b/mysql-test/r/rpl_ndb_sync.result
@@ -60,11 +60,11 @@ hex(c2) hex(c3) c1
0 1 BCDEF
1 0 CD
0 0 DEFGHIJKL
-SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status;
+SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
@the_epoch:=MAX(epoch)
<the_epoch>
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-FROM mysql.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
+FROM mysql.ndb_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
@@ -72,8 +72,8 @@ 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>
+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 Master_SSL_Verify_Server_Cert
+<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> No
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
hex(c1) hex(c2) c3
1 1 row1
@@ -89,8 +89,8 @@ hex(c2) hex(c3) c1
DROP DATABASE ndbsynctest;
STOP SLAVE;
reset master;
-select * from mysql.binlog_index;
+select * from mysql.ndb_binlog_index;
Position File epoch inserts updates deletes schemaops
reset slave;
-select * from mysql.apply_status;
-server_id epoch
+select * from mysql.ndb_apply_status;
+server_id epoch log_name start_pos end_pos
diff --git a/mysql-test/r/rpl_openssl.result b/mysql-test/r/rpl_openssl.result
deleted file mode 100644
index 4fe02088632..00000000000
--- a/mysql-test/r/rpl_openssl.result
+++ /dev/null
@@ -1,31 +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;
-grant replication slave on *.* to replssl@localhost require ssl;
-create table t1 (t int);
-stop slave;
-change master to master_user='replssl',master_password='';
-start slave;
-insert into t1 values (1);
-select * from t1;
-t
-stop slave;
-change master to master_ssl=1 , master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
-start slave;
-select * from t1;
-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 # # # # # # 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;
-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 # # # # # # 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_packet.result b/mysql-test/r/rpl_packet.result
index a5c9b43cabb..8f4a16341b6 100644
--- a/mysql-test/r/rpl_packet.result
+++ b/mysql-test/r/rpl_packet.result
@@ -14,4 +14,19 @@ INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
select count(*) from `DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________`.`t1` /* must be 1 */;
count(*)
1
+SHOW STATUS LIKE 'Slave_running';
+Variable_name Value
+Slave_running ON
+select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
+VARIABLE_NAME VARIABLE_VALUE
+SLAVE_RUNNING 1.0000000
drop database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
+SET @@global.max_allowed_packet=4096;
+SET @@global.net_buffer_length=4096;
+STOP SLAVE;
+START SLAVE;
+CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
+SHOW STATUS LIKE 'Slave_running';
+Variable_name Value
+Slave_running OFF
diff --git a/mysql-test/r/rpl_rbr_to_sbr.result b/mysql-test/r/rpl_rbr_to_sbr.result
index 4b2d129c732..47adb70bcf5 100644
--- a/mysql-test/r/rpl_rbr_to_sbr.result
+++ b/mysql-test/r/rpl_rbr_to_sbr.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 450
+Read_Master_Log_Pos 454
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -43,7 +43,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 450
+Exec_Master_Log_Pos 454
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -55,6 +55,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
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
diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result
index dd16626cbe3..64866df1c15 100644
--- a/mysql-test/r/rpl_redirect.result
+++ b/mysql-test/r/rpl_redirect.result
@@ -5,7 +5,7 @@ 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
+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 Master_SSL_Verify_Server_Cert
SHOW SLAVE HOSTS;
Server_id Host Port Rpl_recovery_rank Master_id
2 127.0.0.1 SLAVE_PORT 2 1
diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result
index 51a281fdb12..fa4f7e224d1 100644
--- a/mysql-test/r/rpl_replicate_do.result
+++ b/mysql-test/r/rpl_replicate_do.result
@@ -27,8 +27,8 @@ select * from t11;
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 # # # master-bin.000001 Yes Yes test.t1 # 0 0 # # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 # # # master-bin.000001 Yes Yes test.t1 # 0 0 # # None 0 No # 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_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index 264f5d224bd..9adde45f87a 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -15,8 +15,8 @@ insert into temp_table values ("testing temporary tables");
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 552 # # master-bin.000001 Yes Yes # 0 0 552 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 556 # # master-bin.000001 Yes Yes # 0 0 556 # None 0 No # 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 596
-master-bin.000002 367
-master-bin.000003 102
+master-bin.000001 600
+master-bin.000002 371
+master-bin.000003 106
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 367
-master-bin.000003 411
+master-bin.000002 371
+master-bin.000003 415
purge binary logs to 'master-bin.000002';
show binary logs;
Log_name File_size
-master-bin.000002 367
-master-bin.000003 411
+master-bin.000002 371
+master-bin.000003 415
purge master logs before now();
show binary logs;
Log_name File_size
-master-bin.000003 411
+master-bin.000003 415
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 500 # # master-bin.000003 Yes Yes # 0 0 500 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 504 # # master-bin.000003 Yes Yes # 0 0 504 # None 0 No # 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 4189
-master-bin.000004 4194
-master-bin.000005 2036
+master-bin.000003 4193
+master-bin.000004 4198
+master-bin.000005 2040
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000005 2036
+master-bin.000005 2040
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 2036 # # master-bin.000005 Yes Yes # 0 0 2036 # None 0 No #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2040 # # master-bin.000005 Yes Yes # 0 0 2040 # None 0 No # No
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
diff --git a/mysql-test/r/rpl_row_basic_11bugs-master.opt b/mysql-test/r/rpl_row_basic_11bugs-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/r/rpl_row_basic_11bugs-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/r/rpl_row_basic_11bugs-slave.opt b/mysql-test/r/rpl_row_basic_11bugs-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/r/rpl_row_basic_11bugs-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/r/rpl_row_basic_11bugs.result b/mysql-test/r/rpl_row_basic_11bugs.result
index 6f7bd6e3f85..1025b965589 100644
--- a/mysql-test/r/rpl_row_basic_11bugs.result
+++ b/mysql-test/r/rpl_row_basic_11bugs.result
@@ -24,11 +24,11 @@ SHOW TABLES;
Tables_in_test_ignore
t2
INSERT INTO t2 VALUES (3,3), (4,4);
-SHOW BINLOG EVENTS FROM 102;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
**** On Slave ****
SHOW DATABASES;
Database
@@ -54,10 +54,10 @@ 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
+master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 192 Table_map 1 231 table_id: # (test.t1)
+master-bin.000001 231 Write_rows 1 270 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;
@@ -119,4 +119,102 @@ HEX(a) b
SELECT HEX(a),b FROM t1;
HEX(a) b
0 2
-DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+================ Test for BUG#22583 ================
+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_myisam (k INT, a BIT(1), b BIT(9)) ENGINE=MYISAM;
+CREATE TABLE t1_innodb (k INT, a BIT(1), b BIT(9)) ENGINE=INNODB;
+CREATE TABLE t2_myisam (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=MYISAM;
+CREATE TABLE t2_innodb (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=INNODB;
+**** On Slave ****
+ALTER TABLE t1_myisam ENGINE=INNODB;
+ALTER TABLE t1_innodb ENGINE=MYISAM;
+ALTER TABLE t2_myisam ENGINE=INNODB;
+ALTER TABLE t2_innodb ENGINE=MYISAM;
+**** On Master ****
+INSERT INTO t1_myisam VALUES(1, b'0', 257);
+INSERT INTO t1_myisam VALUES(2, b'1', 256);
+INSERT INTO t1_innodb VALUES(1, b'0', 257);
+INSERT INTO t1_innodb VALUES(2, b'1', 256);
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+k HEX(a) HEX(b)
+1 0 101
+2 1 100
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+k HEX(a) HEX(b)
+1 0 101
+2 1 100
+INSERT INTO t2_myisam VALUES(1, b'0', 9);
+INSERT INTO t2_myisam VALUES(2, b'1', 8);
+INSERT INTO t2_innodb VALUES(1, b'0', 9);
+INSERT INTO t2_innodb VALUES(2, b'1', 8);
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+k HEX(a) HEX(b)
+1 0 9
+2 1 8
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+k HEX(a) HEX(b)
+1 0 9
+2 1 8
+**** On Slave ****
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+k HEX(a) HEX(b)
+1 0 101
+2 1 100
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+k HEX(a) HEX(b)
+1 0 101
+2 1 100
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+k HEX(a) HEX(b)
+1 0 9
+2 1 8
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+k HEX(a) HEX(b)
+1 0 9
+2 1 8
+**** On Master ****
+UPDATE t1_myisam SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+k HEX(a) HEX(b)
+1 0 101
+2 0 100
+UPDATE t1_innodb SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+k HEX(a) HEX(b)
+1 0 101
+2 0 100
+UPDATE t2_myisam SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+k HEX(a) HEX(b)
+1 0 9
+2 0 8
+UPDATE t2_innodb SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+k HEX(a) HEX(b)
+1 0 9
+2 0 8
+**** On Slave ****
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+k HEX(a) HEX(b)
+1 0 101
+2 0 100
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+k HEX(a) HEX(b)
+1 0 101
+2 0 100
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+k HEX(a) HEX(b)
+1 0 9
+2 0 8
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+k HEX(a) HEX(b)
+1 0 9
+2 0 8
+**** On Master ****
+DROP TABLE IF EXISTS t1_myisam, t1_innodb, t2_myisam, t2_innodb;
diff --git a/mysql-test/r/rpl_row_charset.result b/mysql-test/r/rpl_row_charset.result
index 79cf75c8cc1..e51f3e57d1f 100644
--- a/mysql-test/r/rpl_row_charset.result
+++ b/mysql-test/r/rpl_row_charset.result
@@ -109,39 +109,39 @@ a b
1 cp850_general_ci
drop database mysqltest2;
drop database mysqltest3;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # drop database if exists mysqltest2
+master-bin.000001 # Query # # drop database if exists mysqltest3
+master-bin.000001 # Query # # create database mysqltest2 character set latin2
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # drop database mysqltest3
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # drop database mysqltest2
+master-bin.000001 # Query # # drop database mysqltest3
select "--- --global--" as "";
--- --global--
diff --git a/mysql-test/r/rpl_row_create_table.result b/mysql-test/r/rpl_row_create_table.result
index 8f587fb5796..e76ce5b962d 100644
--- a/mysql-test/r/rpl_row_create_table.result
+++ b/mysql-test/r/rpl_row_create_table.result
@@ -8,30 +8,30 @@ 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;
+SHOW BINLOG EVENTS FROM 216;
Log_name #
-Pos 212
+Pos 216
Event_type Query
Server_id #
-End_log_pos #
+End_log_pos 309
Info use `test`; CREATE TABLE t1 (a INT, b INT)
Log_name #
-Pos 305
+Pos 309
Event_type Query
Server_id #
-End_log_pos #
+End_log_pos 415
Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
Log_name #
-Pos 411
+Pos 415
Event_type Query
Server_id #
-End_log_pos #
+End_log_pos 521
Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
Log_name #
-Pos 517
+Pos 521
Event_type Query
Server_id #
-End_log_pos #
+End_log_pos 640
Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
**** On Master ****
SHOW CREATE TABLE t1;
@@ -127,7 +127,7 @@ NULL 5 10
NULL 6 12
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
ERROR 23000: Duplicate entry '2' for key 'b'
-SHOW BINLOG EVENTS FROM 1118;
+SHOW BINLOG EVENTS FROM 1098;
Log_name Pos Event_type Server_id End_log_pos Info
CREATE TABLE t7 (a INT, b INT UNIQUE);
INSERT INTO t7 SELECT a,b FROM tt3;
@@ -137,11 +137,11 @@ a b
1 2
2 4
3 6
-SHOW BINLOG EVENTS FROM 1118;
+SHOW BINLOG EVENTS FROM 1098;
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
+# 1098 Query # 1198 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
+# 1198 Table_map # 1238 table_id: # (test.t7)
+# 1238 Write_rows # 1294 table_id: # flags: STMT_END_F
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -154,10 +154,10 @@ INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-SHOW BINLOG EVENTS FROM 1314;
+SHOW BINLOG EVENTS FROM 1294;
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
+# 1294 Table_map # 1334 table_id: # (test.t7)
+# 1334 Write_rows # 1390 table_id: # flags: STMT_END_F
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -192,10 +192,10 @@ Create Table CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-SHOW BINLOG EVENTS FROM 1410;
+SHOW BINLOG EVENTS FROM 1390;
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` (
+# 1390 Query # 1476 use `test`; CREATE TABLE t8 LIKE t4
+# 1476 Query # 1615 use `test`; CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
)
@@ -274,33 +274,33 @@ a
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: #, Binlog ver: #
-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 271 table_id: # flags: STMT_END_F
-master-bin.000001 271 Query 1 339 use `test`; BEGIN
-master-bin.000001 339 Query 1 125 use `test`; CREATE TABLE `t2` (
+# 4 Format_desc # 106 Server ver: #, Binlog ver: #
+# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
+# 192 Table_map # 231 table_id: # (test.t1)
+# 231 Write_rows # 275 table_id: # flags: STMT_END_F
+# 275 Query # 343 use `test`; BEGIN
+# 343 Query # 125 use `test`; CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
-master-bin.000001 464 Table_map 1 164 table_id: # (test.t2)
-master-bin.000001 503 Write_rows 1 208 table_id: # flags: STMT_END_F
-master-bin.000001 547 Xid 1 574 COMMIT /* XID */
-master-bin.000001 574 Query 1 642 use `test`; BEGIN
-master-bin.000001 642 Query 1 125 use `test`; CREATE TABLE `t3` (
+# 468 Table_map # 164 table_id: # (test.t2)
+# 507 Write_rows # 208 table_id: # flags: STMT_END_F
+# 551 Xid # 578 COMMIT /* XID */
+# 578 Query # 646 use `test`; BEGIN
+# 646 Query # 125 use `test`; CREATE TABLE `t3` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
-master-bin.000001 767 Table_map 1 164 table_id: # (test.t3)
-master-bin.000001 806 Write_rows 1 208 table_id: # flags: STMT_END_F
-master-bin.000001 850 Xid 1 877 COMMIT /* XID */
-master-bin.000001 877 Query 1 945 use `test`; BEGIN
-master-bin.000001 945 Query 1 125 use `test`; CREATE TABLE `t4` (
+# 771 Table_map # 164 table_id: # (test.t3)
+# 810 Write_rows # 208 table_id: # flags: STMT_END_F
+# 854 Xid # 881 COMMIT /* XID */
+# 881 Query # 949 use `test`; BEGIN
+# 949 Query # 125 use `test`; CREATE TABLE `t4` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
-master-bin.000001 1070 Table_map 1 164 table_id: # (test.t4)
-master-bin.000001 1109 Write_rows 1 208 table_id: # flags: STMT_END_F
-master-bin.000001 1153 Xid 1 1180 COMMIT /* XID */
-master-bin.000001 1180 Table_map 1 1219 table_id: # (test.t1)
-master-bin.000001 1219 Write_rows 1 1263 table_id: # flags: STMT_END_F
+# 1074 Table_map # 164 table_id: # (test.t4)
+# 1113 Write_rows # 208 table_id: # flags: STMT_END_F
+# 1157 Xid # 1184 COMMIT /* XID */
+# 1184 Table_map # 1223 table_id: # (test.t1)
+# 1223 Write_rows # 1267 table_id: # flags: STMT_END_F
SHOW TABLES;
Tables_in_test
t1
@@ -365,17 +365,17 @@ a
9
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 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 271 table_id: # flags: STMT_END_F
-master-bin.000001 271 Query 1 371 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
-master-bin.000001 371 Query 1 439 use `test`; BEGIN
-master-bin.000001 439 Table_map 1 39 table_id: # (test.t2)
-master-bin.000001 478 Write_rows 1 83 table_id: # flags: STMT_END_F
-master-bin.000001 522 Table_map 1 122 table_id: # (test.t2)
-master-bin.000001 561 Write_rows 1 161 table_id: # flags: STMT_END_F
-master-bin.000001 600 Xid 1 627 COMMIT /* XID */
+# 4 Format_desc # 106 Server ver: #, Binlog ver: #
+# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
+# 192 Table_map # 231 table_id: # (test.t1)
+# 231 Write_rows # 275 table_id: # flags: STMT_END_F
+# 275 Query # 375 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
+# 375 Query # 443 use `test`; BEGIN
+# 443 Table_map # 39 table_id: # (test.t2)
+# 482 Write_rows # 83 table_id: # flags: STMT_END_F
+# 526 Table_map # 122 table_id: # (test.t2)
+# 565 Write_rows # 161 table_id: # flags: STMT_END_F
+# 604 Xid # 631 COMMIT /* XID */
SELECT * FROM t2 ORDER BY a;
a
1
@@ -394,10 +394,10 @@ INSERT INTO t2 SELECT a+2 FROM tt2;
ROLLBACK;
SELECT * FROM t2 ORDER BY a;
a
-SHOW BINLOG EVENTS FROM 627;
+SHOW BINLOG EVENTS FROM 631;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 627 Query 1 80 use `test`; TRUNCATE TABLE t2
-master-bin.000001 707 Xid 1 734 COMMIT /* XID */
+# 631 Query # 80 use `test`; TRUNCATE TABLE t2
+# 711 Xid # 738 COMMIT /* XID */
SELECT * FROM t2 ORDER BY a;
a
DROP TABLE t1,t2;
diff --git a/mysql-test/r/rpl_row_delayed_ins.result b/mysql-test/r/rpl_row_delayed_ins.result
index 21b251db193..800a39bd567 100644
--- a/mysql-test/r/rpl_row_delayed_ins.result
+++ b/mysql-test/r/rpl_row_delayed_ins.result
@@ -14,17 +14,16 @@ a
1
2
3
-show binlog events;
+show binlog events from <binlog_start>;
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 368 table_id: # flags: STMT_END_F
-master-bin.000001 368 Table_map 1 407 table_id: # (test.t1)
-master-bin.000001 407 Write_rows 1 441 table_id: # flags: STMT_END_F
-master-bin.000001 441 Query 1 516 use `test`; flush tables
+master-bin.000001 # Query # # use `test`; create table t1(a int not null primary key) engine=myisam
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; flush tables
SELECT * FROM t1 ORDER BY a;
a
1
diff --git a/mysql-test/r/rpl_row_drop.result b/mysql-test/r/rpl_row_drop.result
index 4ef21884fda..89654ebf165 100644
--- a/mysql-test/r/rpl_row_drop.result
+++ b/mysql-test/r/rpl_row_drop.result
@@ -43,10 +43,10 @@ t2
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 */
+master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a int)
+master-bin.000001 192 Query 1 278 use `test`; CREATE TABLE t2 (a int)
+master-bin.000001 278 Query 1 382 use `test`; DROP TABLE `t1` /* generated by server */
SHOW TABLES;
Tables_in_test
t2
diff --git a/mysql-test/r/rpl_row_flsh_tbls.result b/mysql-test/r/rpl_row_flsh_tbls.result
index e2352b8605b..942a6b83bf6 100644
--- a/mysql-test/r/rpl_row_flsh_tbls.result
+++ b/mysql-test/r/rpl_row_flsh_tbls.result
@@ -12,13 +12,13 @@ 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 ;
+SHOW BINLOG EVENTS FROM 619 ;
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 ;
+SHOW BINLOG EVENTS FROM 619 ;
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
diff --git a/mysql-test/r/rpl_row_inexist_tbl.result b/mysql-test/r/rpl_row_inexist_tbl.result
index 5f5a4556d76..4412a1fa75c 100644
--- a/mysql-test/r/rpl_row_inexist_tbl.result
+++ b/mysql-test/r/rpl_row_inexist_tbl.result
@@ -39,7 +39,7 @@ 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
+Exec_Master_Log_Pos 524
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -51,4 +51,5 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
drop table t1, t2;
diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result
index c6b85e7b329..9de0d3d0ebb 100644
--- a/mysql-test/r/rpl_row_log.result
+++ b/mysql-test/r/rpl_row_log.result
@@ -26,14 +26,14 @@ 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;
+show binlog events from 106 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;
+show binlog events from 106 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;
+show binlog events from 106 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;
@@ -47,17 +47,16 @@ flush logs;
stop slave;
create table t2 (n int)ENGINE=MyISAM;
insert into t2 values (1);
-show binlog events;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Rotate # # 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
@@ -67,13 +66,13 @@ 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
+master-bin.000001 1260
+master-bin.000002 377
start slave;
show binary logs;
Log_name File_size
-slave-bin.000001 1354
-slave-bin.000002 274
+slave-bin.000001 1358
+slave-bin.000002 278
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
@@ -93,8 +92,8 @@ 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 377 # # master-bin.000002 Yes Yes # 0 0 377 # None 0 No # 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;
@@ -105,11 +104,10 @@ 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;
+show binlog events from <binlog_start>;
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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
select * from t1;
a b
1 1
diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result
index bc13047f973..4d8175142b2 100644
--- a/mysql-test/r/rpl_row_log_innodb.result
+++ b/mysql-test/r/rpl_row_log_innodb.result
@@ -28,14 +28,14 @@ master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not nul
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;
+show binlog events from 106 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;
+show binlog events from 106 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;
+show binlog events from 106 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;
@@ -49,19 +49,18 @@ flush logs;
stop slave;
create table t2 (n int)ENGINE=InnoDB;
insert into t2 values (1);
-show binlog events;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Rotate # # 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
@@ -72,13 +71,13 @@ 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
+master-bin.000001 1314
+master-bin.000002 404
start slave;
show binary logs;
Log_name File_size
-slave-bin.000001 1408
-slave-bin.000002 301
+slave-bin.000001 1412
+slave-bin.000002 305
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
@@ -101,8 +100,8 @@ 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 404 # # master-bin.000002 Yes Yes # 0 0 404 # None 0 No # 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;
@@ -113,11 +112,10 @@ 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;
+show binlog events from <binlog_start>;
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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
select * from t1;
a b
1 1
diff --git a/mysql-test/r/rpl_row_max_relay_size.result b/mysql-test/r/rpl_row_max_relay_size.result
index 8bb10ffb080..cb1692568fc 100644
--- a/mysql-test/r/rpl_row_max_relay_size.result
+++ b/mysql-test/r/rpl_row_max_relay_size.result
@@ -30,7 +30,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 58664
+Read_Master_Log_Pos 58668
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -45,7 +45,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 58664
+Exec_Master_Log_Pos 58668
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -57,6 +57,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 2
#
@@ -73,7 +74,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 58664
+Read_Master_Log_Pos 58668
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -88,7 +89,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 58664
+Exec_Master_Log_Pos 58668
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -100,6 +101,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 3: max_relay_log_size = 0
#
@@ -116,7 +118,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 58664
+Read_Master_Log_Pos 58668
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -131,7 +133,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 58664
+Exec_Master_Log_Pos 58668
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -143,6 +145,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -183,6 +186,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 5
#
@@ -197,7 +201,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 58750
+Read_Master_Log_Pos 58754
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -212,7 +216,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 58750
+Exec_Master_Log_Pos 58754
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -224,6 +228,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
@@ -236,7 +241,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 58826
+Read_Master_Log_Pos 58830
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -251,7 +256,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 58826
+Exec_Master_Log_Pos 58830
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -263,10 +268,11 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
flush logs;
show master status;
File master-bin.000002
-Position 102
+Position 106
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_row_reset_slave.result b/mysql-test/r/rpl_row_reset_slave.result
index 57fc95708e5..c9ae5ced7bc 100644
--- a/mysql-test/r/rpl_row_reset_slave.result
+++ b/mysql-test/r/rpl_row_reset_slave.result
@@ -5,21 +5,21 @@ 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No # 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
stop slave;
reset slave;
start slave;
diff --git a/mysql-test/r/rpl_row_tabledefs_2myisam.result b/mysql-test/r/rpl_row_tabledefs_2myisam.result
index 10001c736ac..4eca19ff098 100644
--- a/mysql-test/r/rpl_row_tabledefs_2myisam.result
+++ b/mysql-test/r/rpl_row_tabledefs_2myisam.result
@@ -137,6 +137,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2);
@@ -175,6 +176,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (4);
@@ -213,6 +215,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (5);
@@ -251,6 +254,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -289,6 +293,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -326,6 +331,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
INSERT INTO t7 VALUES (1),(2),(3);
INSERT INTO t8 VALUES (1),(2),(3);
SELECT * FROM t7 ORDER BY a;
diff --git a/mysql-test/r/rpl_row_tabledefs_3innodb.result b/mysql-test/r/rpl_row_tabledefs_3innodb.result
index 6bb98afd4c4..687108e17e5 100644
--- a/mysql-test/r/rpl_row_tabledefs_3innodb.result
+++ b/mysql-test/r/rpl_row_tabledefs_3innodb.result
@@ -137,6 +137,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2);
@@ -175,6 +176,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (4);
@@ -213,6 +215,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (5);
@@ -251,6 +254,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -289,6 +293,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -326,6 +331,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
INSERT INTO t7 VALUES (1),(2),(3);
INSERT INTO t8 VALUES (1),(2),(3);
SELECT * FROM t7 ORDER BY a;
diff --git a/mysql-test/r/rpl_row_until.result b/mysql-test/r/rpl_row_until.result
index 8d4b0d6b591..c691185650a 100644
--- a/mysql-test/r/rpl_row_until.result
+++ b/mysql-test/r/rpl_row_until.result
@@ -20,8 +20,8 @@ n
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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-bin.000001 311 No # No
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
@@ -30,22 +30,22 @@ n
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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-no-such-bin.000001 291 No # 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 590 # Relay slave-relay-bin.000004 728 No # 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 744 # Master master-bin.000001 740 No # 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;
diff --git a/mysql-test/r/rpl_server_id1.result b/mysql-test/r/rpl_server_id1.result
index c94a7748fcd..8f82ca8ea12 100644
--- a/mysql-test/r/rpl_server_id1.result
+++ b/mysql-test/r/rpl_server_id1.result
@@ -9,8 +9,8 @@ reset master;
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 102 None 0 No NULL
+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 Master_SSL_Verify_Server_Cert
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 106 None 0 No NULL No
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 72db862040e..a5c7fc07714 100644
--- a/mysql-test/r/rpl_server_id2.result
+++ b/mysql-test/r/rpl_server_id2.result
@@ -9,8 +9,8 @@ reset master;
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 102 None 0 No NULL
+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 Master_SSL_Verify_Server_Cert
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 106 None 0 No NULL No
start slave;
insert into t1 values (1);
select * from t1;
diff --git a/mysql-test/r/rpl_slave_status.result b/mysql-test/r/rpl_slave_status.result
index c7a5d32ddd7..29ec7b77b45 100644
--- a/mysql-test/r/rpl_slave_status.result
+++ b/mysql-test/r/rpl_slave_status.result
@@ -52,6 +52,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master NULL
+Master_SSL_Verify_Server_Cert No
drop table t1;
delete from mysql.user where user='rpl';
drop table t1;
diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result
index ea07a86d009..6dc3be94e32 100644
--- a/mysql-test/r/rpl_sp.result
+++ b/mysql-test/r/rpl_sp.result
@@ -381,7 +381,7 @@ return 0;
end|
use mysqltest;
set @a:= mysqltest2.f1();
-show binlog events in 'master-bin.000001' from 102;
+show binlog events in 'master-bin.000001' from 106;
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_ssl.result b/mysql-test/r/rpl_ssl.result
index 33deb9a8c92..908f0020188 100644
--- a/mysql-test/r/rpl_ssl.result
+++ b/mysql-test/r/rpl_ssl.result
@@ -53,10 +53,12 @@ Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
STOP SLAVE;
select * from t1;
t
1
+insert into t1 values (NULL);
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1
@@ -91,3 +93,6 @@ Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+drop user replssl@localhost;
+drop table t1;
diff --git a/mysql-test/r/rpl_ssl1.result b/mysql-test/r/rpl_ssl1.result
new file mode 100644
index 00000000000..6bc4b53849f
--- /dev/null
+++ b/mysql-test/r/rpl_ssl1.result
@@ -0,0 +1,146 @@
+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;
+grant replication slave on *.* to replssl@localhost require ssl;
+create table t1 (t int);
+stop slave;
+change master to master_user='replssl',master_password='';
+start slave;
+insert into t1 values (1);
+select * from t1;
+t
+stop slave;
+change master to master_ssl=1 , master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+select * from t1;
+t
+1
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User replssl
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File #
+Slave_IO_Running #
+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 Yes
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+stop slave;
+change master to master_user='root',master_password='', master_ssl=0;
+start slave;
+drop user replssl@localhost;
+drop table t1;
+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 #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File #
+Slave_IO_Running #
+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 MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+stop slave;
+change master to
+master_host="localhost",
+master_ssl=1 ,
+master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem',
+master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem',
+master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem',
+master_ssl_verify_server_cert=1;
+start slave;
+create table t1 (t int);
+insert into t1 values (1);
+on slave
+select * from t1;
+t
+1
+show slave status;
+Slave_IO_State #
+Master_Host localhost
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File #
+Slave_IO_Running #
+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 Yes
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert Yes
+drop table t1;
diff --git a/mysql-test/r/rpl_stm_charset.result b/mysql-test/r/rpl_stm_charset.result
index f1691608bc7..fd9c40843d5 100644
--- a/mysql-test/r/rpl_stm_charset.result
+++ b/mysql-test/r/rpl_stm_charset.result
@@ -103,40 +103,40 @@ a b
1 cp850_general_ci
drop database mysqltest2;
drop database mysqltest3;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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 # Intvar 1 # INSERT_ID=1
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_server)
-master-bin.000001 # Intvar 1 # INSERT_ID=2
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_server)
-master-bin.000001 # Intvar 1 # INSERT_ID=3
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_client)
-master-bin.000001 # Intvar 1 # INSERT_ID=4
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_connection)
-master-bin.000001 # Intvar 1 # INSERT_ID=5
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
-master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
-master-bin.000001 # Intvar 1 # INSERT_ID=1
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
-master-bin.000001 # Intvar 1 # INSERT_ID=2
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
-master-bin.000001 # Intvar 1 # INSERT_ID=3
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
-master-bin.000001 # Intvar 1 # INSERT_ID=4
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
-master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
-master-bin.000001 # Intvar 1 # INSERT_ID=1
-master-bin.000001 # User var 1 # @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(collation(@a))
-master-bin.000001 # Query 1 # drop database mysqltest2
-master-bin.000001 # Query 1 # drop database mysqltest3
+master-bin.000001 # Query # # drop database if exists mysqltest2
+master-bin.000001 # Query # # drop database if exists mysqltest3
+master-bin.000001 # Query # # create database mysqltest2 character set latin2
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # drop database mysqltest3
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@character_set_server)
+master-bin.000001 # Intvar # # INSERT_ID=2
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_server)
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@character_set_client)
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@character_set_connection)
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 # Intvar # # INSERT_ID=2
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # User var # # @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(collation(@a))
+master-bin.000001 # Query # # drop database mysqltest2
+master-bin.000001 # Query # # drop database mysqltest3
set global character_set_server=latin2;
set global character_set_server=latin1;
set global character_set_server=latin2;
diff --git a/mysql-test/r/rpl_stm_flsh_tbls.result b/mysql-test/r/rpl_stm_flsh_tbls.result
index a6123d75cb3..1c6b5615b6e 100644
--- a/mysql-test/r/rpl_stm_flsh_tbls.result
+++ b/mysql-test/r/rpl_stm_flsh_tbls.result
@@ -12,13 +12,13 @@ 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 ;
+SHOW BINLOG EVENTS FROM 656 ;
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 ;
+SHOW BINLOG EVENTS FROM 656 ;
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
diff --git a/mysql-test/r/rpl_stm_log.result b/mysql-test/r/rpl_stm_log.result
index 496685981aa..3ee2d990159 100644
--- a/mysql-test/r/rpl_stm_log.result
+++ b/mysql-test/r/rpl_stm_log.result
@@ -26,14 +26,14 @@ 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;
+show binlog events from 106 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;
+show binlog events from 106 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;
+show binlog events from 106 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;
@@ -47,17 +47,16 @@ flush logs;
stop slave;
create table t2 (n int)ENGINE=MyISAM;
insert into t2 values (1);
-show binlog events;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=581
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
+master-bin.000001 # Rotate # # 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
@@ -66,13 +65,13 @@ 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
+master-bin.000001 1347
+master-bin.000002 392
start slave;
show binary logs;
Log_name File_size
-slave-bin.000001 1443
-slave-bin.000002 289
+slave-bin.000001 1447
+slave-bin.000002 293
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
@@ -91,8 +90,8 @@ 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 392 # # master-bin.000002 Yes Yes # 0 0 392 # None 0 No # 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;
@@ -103,12 +102,11 @@ 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;
+show binlog events from <binlog_start>;
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 # Intvar 1 # LAST_INSERT_ID=1
-master-bin.000001 # Intvar 1 # INSERT_ID=5
-master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
+master-bin.000001 # Intvar # # LAST_INSERT_ID=1
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
select * from t1;
a b
1 1
diff --git a/mysql-test/r/rpl_stm_max_relay_size.result b/mysql-test/r/rpl_stm_max_relay_size.result
index c4a9a5bd3ff..c2e57be6ad4 100644
--- a/mysql-test/r/rpl_stm_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 72956
+Read_Master_Log_Pos 72960
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -43,7 +43,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 72956
+Exec_Master_Log_Pos 72960
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -55,6 +55,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 2
#
@@ -71,7 +72,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 72956
+Read_Master_Log_Pos 72960
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -86,7 +87,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 72956
+Exec_Master_Log_Pos 72960
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -98,6 +99,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 3: max_relay_log_size = 0
#
@@ -114,7 +116,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 72956
+Read_Master_Log_Pos 72960
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -129,7 +131,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 72956
+Exec_Master_Log_Pos 72960
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -141,6 +143,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -181,6 +184,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 5
#
@@ -195,7 +199,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 73042
+Read_Master_Log_Pos 73046
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -210,7 +214,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 73042
+Exec_Master_Log_Pos 73046
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -222,6 +226,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
@@ -234,7 +239,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 73118
+Read_Master_Log_Pos 73122
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -249,7 +254,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 73118
+Exec_Master_Log_Pos 73122
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -261,10 +266,11 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
flush logs;
show master status;
File master-bin.000002
-Position 102
+Position 106
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_stm_multi_query.result b/mysql-test/r/rpl_stm_multi_query.result
index bf914e6ce6c..625c686f383 100644
--- a/mysql-test/r/rpl_stm_multi_query.result
+++ b/mysql-test/r/rpl_stm_multi_query.result
@@ -19,14 +19,14 @@ n
3
4
5
-show binlog events from 102;
+show binlog events from <binlog_start>;
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 # Query 1 # use `test`; create table mysqltest.t1 ( n int)
-master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(1)
-master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(2)
-master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(3)
-master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(4)
-master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(5)
+master-bin.000001 # Query # # drop database if exists mysqltest
+master-bin.000001 # Query # # create database mysqltest
+master-bin.000001 # Query # # use `test`; create table mysqltest.t1 ( n int)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(1)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(2)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(3)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(4)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(5)
drop database mysqltest;
diff --git a/mysql-test/r/rpl_stm_reset_slave.result b/mysql-test/r/rpl_stm_reset_slave.result
index 834b9add089..e134629d597 100644
--- a/mysql-test/r/rpl_stm_reset_slave.result
+++ b/mysql-test/r/rpl_stm_reset_slave.result
@@ -5,21 +5,21 @@ 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No # 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # 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 #
+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 Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
stop slave;
reset slave;
start slave;
diff --git a/mysql-test/r/rpl_stm_until.result b/mysql-test/r/rpl_stm_until.result
index e8e33b66864..ffe6216a42b 100644
--- a/mysql-test/r/rpl_stm_until.result
+++ b/mysql-test/r/rpl_stm_until.result
@@ -26,7 +26,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 780
+Read_Master_Log_Pos 784
Relay_Log_File slave-relay-bin.000004
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -41,7 +41,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 323
+Exec_Master_Log_Pos 327
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-bin.000001
@@ -53,6 +53,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
@@ -67,7 +68,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 780
+Read_Master_Log_Pos 784
Relay_Log_File slave-relay-bin.000004
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -82,7 +83,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 323
+Exec_Master_Log_Pos 327
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-no-such-bin.000001
@@ -94,6 +95,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
select * from t2;
n
@@ -106,7 +108,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 780
+Read_Master_Log_Pos 784
Relay_Log_File slave-relay-bin.000004
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -121,7 +123,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 612
+Exec_Master_Log_Pos 616
Relay_Log_Space #
Until_Condition Relay
Until_Log_File slave-relay-bin.000004
@@ -133,6 +135,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
start slave;
stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=776;
@@ -143,7 +146,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 780
+Read_Master_Log_Pos 784
Relay_Log_File slave-relay-bin.000004
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -158,7 +161,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 780
+Exec_Master_Log_Pos 784
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-bin.000001
@@ -170,6 +173,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert 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;
diff --git a/mysql-test/r/rpl_switch_stm_row_mixed.result b/mysql-test/r/rpl_switch_stm_row_mixed.result
index fe0d986eba6..6d9f1a32980 100644
--- a/mysql-test/r/rpl_switch_stm_row_mixed.result
+++ b/mysql-test/r/rpl_switch_stm_row_mixed.result
@@ -405,84 +405,84 @@ CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
INSERT INTO t12 VALUES(UUID());
UNLOCK TABLES;
-show binlog events from 102;
+show binlog events from <binlog_start>;
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` (
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Query # # create database mysqltest1
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_8_")
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_9_")
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_10_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_11_"
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_13_")
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_14_")
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_15_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_16_"
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_18_")
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_21_"
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_24_"
+master-bin.000001 # Query # # 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` (
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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` (
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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()
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t4)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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 # # table_id: # (mysqltest1.t5)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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()
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
begin
insert into t1 values(concat("emergency_28_",UUID()));
insert into t1 values("work_29_");
@@ -491,308 +491,308 @@ 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
+master-bin.000001 # Query # # 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))
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello')))
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world')))
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Query # # use `mysqltest1`; drop function foo3
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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 `mysqltest1`.`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
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_')
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid()
+master-bin.000001 # Query # # use `mysqltest1`; create table t11 (data varchar(255))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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 # # 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 # # 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 # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t20 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t21 select * from t2
+master-bin.000001 # Query # # use `mysqltest1`; create table t22 select * from t3
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1,t2,t3
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; create table t3 (b varchar(100))
+master-bin.000001 # Query # # 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 `mysqltest1`.`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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_44_")
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t12 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a))
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_')
+master-bin.000001 # Query # # use `mysqltest1`; create table t13 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; drop function f
+master-bin.000001 # Query # # use `mysqltest1`; create table t14 (unique (a)) select * from t2
+master-bin.000001 # Query # # use `mysqltest1`; truncate table t2
+master-bin.000001 # Query # # 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
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; drop function f2
+master-bin.000001 # Query # # 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 `mysqltest1`.`f1`(_latin1'try_53_')
-master-bin.000001 # Intvar 1 # INSERT_ID=5
-master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`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
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_')
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_')
+master-bin.000001 # Query # # use `mysqltest1`; drop function f2
+master-bin.000001 # Query # # 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` (
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; alter table t1 modify a int, drop primary key
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_57_")
+master-bin.000001 # Query # # 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;
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t16 values("try_66_")
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t11
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene')
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t12
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t12 (data LONG)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t12)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+show binlog events from <binlog_start>;
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` (
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Query # # create database mysqltest1
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_8_")
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_9_")
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_10_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_11_"
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_13_")
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_14_")
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_15_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_16_"
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_18_")
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_21_"
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_24_"
+master-bin.000001 # Query # # 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` (
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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` (
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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()
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t4)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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 # # table_id: # (mysqltest1.t5)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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()
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
begin
insert into t1 values(concat("emergency_28_",UUID()));
insert into t1 values("work_29_");
@@ -801,229 +801,229 @@ 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
+master-bin.000001 # Query # # 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))
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello')))
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world')))
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Query # # use `mysqltest1`; drop function foo3
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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 `mysqltest1`.`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
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_')
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid()
+master-bin.000001 # Query # # use `mysqltest1`; create table t11 (data varchar(255))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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 # # 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 # # 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 # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t20 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t21 select * from t2
+master-bin.000001 # Query # # use `mysqltest1`; create table t22 select * from t3
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1,t2,t3
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; create table t3 (b varchar(100))
+master-bin.000001 # Query # # 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 `mysqltest1`.`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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_44_")
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t12 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a))
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_')
+master-bin.000001 # Query # # use `mysqltest1`; create table t13 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; drop function f
+master-bin.000001 # Query # # use `mysqltest1`; create table t14 (unique (a)) select * from t2
+master-bin.000001 # Query # # use `mysqltest1`; truncate table t2
+master-bin.000001 # Query # # 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
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; drop function f2
+master-bin.000001 # Query # # 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 `mysqltest1`.`f1`(_latin1'try_53_')
-master-bin.000001 # Intvar 1 # INSERT_ID=5
-master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`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
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_')
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_')
+master-bin.000001 # Query # # use `mysqltest1`; drop function f2
+master-bin.000001 # Query # # 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` (
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; alter table t1 modify a int, drop primary key
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_57_")
+master-bin.000001 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t16 values("try_66_")
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t11
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene')
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t12
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t12 (data LONG)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t12)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
drop database mysqltest1;
set global binlog_format =@my_binlog_format;
diff --git a/mysql-test/r/rpl_truncate_2myisam.result b/mysql-test/r/rpl_truncate_2myisam.result
index 41640a709b9..c7ef28ba56b 100644
--- a/mysql-test/r/rpl_truncate_2myisam.result
+++ b/mysql-test/r/rpl_truncate_2myisam.result
@@ -29,13 +29,12 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
@@ -61,13 +60,12 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
@@ -93,14 +91,13 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
@@ -126,13 +123,12 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Query # # use `test`; DELETE FROM t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
@@ -158,13 +154,12 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Query # # use `test`; DELETE FROM t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
@@ -191,12 +186,11 @@ a b
3 3
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_truncate_3innodb.result b/mysql-test/r/rpl_truncate_3innodb.result
index 062c9704ae0..7ce48c2e983 100644
--- a/mysql-test/r/rpl_truncate_3innodb.result
+++ b/mysql-test/r/rpl_truncate_3innodb.result
@@ -29,15 +29,14 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
@@ -63,15 +62,14 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
@@ -97,16 +95,15 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
@@ -132,15 +129,14 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
@@ -166,15 +162,14 @@ SELECT * FROM t1;
a b
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
@@ -201,14 +196,13 @@ a b
3 3
**** On Master ****
DROP TABLE t1;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_truncate_7ndb.result b/mysql-test/r/rpl_truncate_7ndb.result
index 63d4b0f9411..62ace911e45 100644
--- a/mysql-test/r/rpl_truncate_7ndb.result
+++ b/mysql-test/r/rpl_truncate_7ndb.result
@@ -29,16 +29,17 @@ a b
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 95 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 378 Write_rows 1 137 table_id: #
-master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F
-master-bin.000001 467 Query 1 532 COMMIT
-master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1
-master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1
+master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 223 Query 1 287 BEGIN
+master-bin.000001 287 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 385 Write_rows 1 157 table_id: #
+master-bin.000001 444 Write_rows 1 195 table_id: #
+master-bin.000001 482 Write_rows 1 233 table_id: # flags: STMT_END_F
+master-bin.000001 520 Query 1 585 COMMIT
+master-bin.000001 585 Query 1 665 use `test`; TRUNCATE TABLE t1
+master-bin.000001 665 Query 1 741 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);
@@ -65,27 +66,30 @@ a b
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 95 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 378 Write_rows 1 137 table_id: #
-master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F
-master-bin.000001 467 Query 1 532 COMMIT
-master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1
-master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1
-master-bin.000001 688 Query 1 805 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
-master-bin.000001 805 Query 1 869 BEGIN
-master-bin.000001 869 Table_map 1 40 table_id: # (test.t1)
-master-bin.000001 909 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 964 Write_rows 1 137 table_id: #
-master-bin.000001 1006 Write_rows 1 184 table_id: # flags: STMT_END_F
-master-bin.000001 1053 Query 1 1118 COMMIT
-master-bin.000001 1118 Query 1 1182 BEGIN
-master-bin.000001 1182 Table_map 1 40 table_id: # (test.t1)
-master-bin.000001 1222 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 1277 Write_rows 1 137 table_id: #
-master-bin.000001 1319 Delete_rows 1 176 table_id: # flags: STMT_END_F
-master-bin.000001 1358 Query 1 1423 COMMIT
-master-bin.000001 1423 Query 1 1499 use `test`; DROP TABLE t1
+master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 223 Query 1 287 BEGIN
+master-bin.000001 287 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 385 Write_rows 1 157 table_id: #
+master-bin.000001 444 Write_rows 1 195 table_id: #
+master-bin.000001 482 Write_rows 1 233 table_id: # flags: STMT_END_F
+master-bin.000001 520 Query 1 585 COMMIT
+master-bin.000001 585 Query 1 665 use `test`; TRUNCATE TABLE t1
+master-bin.000001 665 Query 1 741 use `test`; DROP TABLE t1
+master-bin.000001 741 Query 1 858 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 858 Query 1 922 BEGIN
+master-bin.000001 922 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 962 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 1020 Write_rows 1 157 table_id: #
+master-bin.000001 1079 Write_rows 1 195 table_id: #
+master-bin.000001 1117 Write_rows 1 233 table_id: # flags: STMT_END_F
+master-bin.000001 1155 Query 1 1220 COMMIT
+master-bin.000001 1220 Query 1 1284 BEGIN
+master-bin.000001 1284 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 1324 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 1382 Write_rows 1 157 table_id: #
+master-bin.000001 1441 Delete_rows 1 191 table_id: #
+master-bin.000001 1475 Delete_rows 1 225 table_id: # flags: STMT_END_F
+master-bin.000001 1509 Query 1 1574 COMMIT
+master-bin.000001 1574 Query 1 1650 use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_udf.result b/mysql-test/r/rpl_udf.result
new file mode 100644
index 00000000000..6587632bca0
--- /dev/null
+++ b/mysql-test/r/rpl_udf.result
@@ -0,0 +1,310 @@
+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=row;
+drop table if exists t1;
+"*** Test 1) Test UDFs via loadable libraries ***
+"Running on the master"
+CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
+affected rows: 0
+CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+affected rows: 0
+CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
+SELECT * FROM mysql.func;
+name ret dl type
+myfunc_double 1 UDF_LIB function
+myfunc_int 2 UDF_LIB function
+affected rows: 2
+"Running on the slave"
+SELECT * FROM mysql.func;
+name ret dl type
+myfunc_double 1 UDF_LIB function
+myfunc_int 2 UDF_LIB function
+affected rows: 2
+"Running on the master"
+CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
+affected rows: 0
+INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
+affected rows: 1
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 48.5
+10 48.75
+100 48.6
+200 49
+affected rows: 4
+"Running on the slave"
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 48.5
+10 48.75
+100 48.6
+200 49
+affected rows: 4
+SELECT myfunc_int(25);
+myfunc_int(25)
+25
+affected rows: 1
+SELECT myfunc_double(75.00);
+myfunc_double(75.00)
+50.00
+affected rows: 1
+"Running on the master"
+DROP FUNCTION myfunc_double;
+affected rows: 0
+DROP FUNCTION myfunc_int;
+affected rows: 0
+SELECT * FROM mysql.func;
+name ret dl type
+affected rows: 0
+"Running on the slave"
+SELECT * FROM mysql.func;
+name ret dl type
+affected rows: 0
+"Running on the master"
+DROP TABLE t1;
+affected rows: 0
+"*** Test 2) Test UDFs with SQL body ***
+"Running on the master"
+CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
+affected rows: 0
+CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
+test myfuncsql_int FUNCTION i INT RETURN i
+affected rows: 2
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
+test myfuncsql_int FUNCTION i INT RETURN i
+affected rows: 2
+"Running on the master"
+CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
+affected rows: 0
+INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
+affected rows: 1
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 1000
+10 10
+100 100
+200 50
+affected rows: 4
+"Running on the slave"
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 1000
+10 10
+100 100
+200 50
+affected rows: 4
+"Running on the master"
+ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
+affected rows: 0
+ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
+test myfuncsql_int FUNCTION i INT RETURN i This was altered.
+affected rows: 2
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
+test myfuncsql_int FUNCTION i INT RETURN i This was altered.
+affected rows: 2
+SELECT myfuncsql_int(25);
+myfuncsql_int(25)
+25
+affected rows: 1
+SELECT myfuncsql_double(75.00);
+myfuncsql_double(75.00)
+150
+affected rows: 1
+"Running on the master"
+DROP FUNCTION myfuncsql_double;
+affected rows: 0
+DROP FUNCTION myfuncsql_int;
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+affected rows: 0
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+affected rows: 0
+"Running on the master"
+DROP TABLE t1;
+affected rows: 0
+set binlog_format=statement;
+drop table if exists t1;
+"*** Test 1) Test UDFs via loadable libraries ***
+"Running on the master"
+CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
+affected rows: 0
+CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+affected rows: 0
+CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
+SELECT * FROM mysql.func;
+name ret dl type
+myfunc_int 2 UDF_LIB function
+myfunc_double 1 UDF_LIB function
+affected rows: 2
+"Running on the slave"
+SELECT * FROM mysql.func;
+name ret dl type
+myfunc_int 2 UDF_LIB function
+myfunc_double 1 UDF_LIB function
+affected rows: 2
+"Running on the master"
+CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
+affected rows: 0
+INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
+affected rows: 1
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 48.5
+10 48.75
+100 48.6
+200 49
+affected rows: 4
+"Running on the slave"
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 48.5
+10 48.75
+100 48.6
+200 49
+affected rows: 4
+SELECT myfunc_int(25);
+myfunc_int(25)
+25
+affected rows: 1
+SELECT myfunc_double(75.00);
+myfunc_double(75.00)
+50.00
+affected rows: 1
+"Running on the master"
+DROP FUNCTION myfunc_double;
+affected rows: 0
+DROP FUNCTION myfunc_int;
+affected rows: 0
+SELECT * FROM mysql.func;
+name ret dl type
+affected rows: 0
+"Running on the slave"
+SELECT * FROM mysql.func;
+name ret dl type
+affected rows: 0
+"Running on the master"
+DROP TABLE t1;
+affected rows: 0
+"*** Test 2) Test UDFs with SQL body ***
+"Running on the master"
+CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
+affected rows: 0
+CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
+test myfuncsql_int FUNCTION i INT RETURN i
+affected rows: 2
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
+test myfuncsql_int FUNCTION i INT RETURN i
+affected rows: 2
+"Running on the master"
+CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
+affected rows: 0
+INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
+affected rows: 1
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 1000
+10 10
+100 100
+200 50
+affected rows: 4
+"Running on the slave"
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 1000
+10 10
+100 100
+200 50
+affected rows: 4
+"Running on the master"
+ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
+affected rows: 0
+ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
+test myfuncsql_int FUNCTION i INT RETURN i This was altered.
+affected rows: 2
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
+test myfuncsql_int FUNCTION i INT RETURN i This was altered.
+affected rows: 2
+SELECT myfuncsql_int(25);
+myfuncsql_int(25)
+25
+affected rows: 1
+SELECT myfuncsql_double(75.00);
+myfuncsql_double(75.00)
+150
+affected rows: 1
+"Running on the master"
+DROP FUNCTION myfuncsql_double;
+affected rows: 0
+DROP FUNCTION myfuncsql_int;
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+affected rows: 0
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+affected rows: 0
+"Running on the master"
+DROP TABLE t1;
+affected rows: 0
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index e9fda0c2ad6..6ffb769292f 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -3933,4 +3933,51 @@ cc cc 7
aa aa 2
aa aa 2
DROP TABLE t1,t2;
+CREATE TABLE t1 (
+access_id int NOT NULL default '0',
+name varchar(20) default NULL,
+rank int NOT NULL default '0',
+KEY idx (access_id)
+);
+CREATE TABLE t2 (
+faq_group_id int NOT NULL default '0',
+faq_id int NOT NULL default '0',
+access_id int default NULL,
+UNIQUE KEY idx1 (faq_id),
+KEY idx2 (faq_group_id,faq_id)
+);
+INSERT INTO t1 VALUES
+(1,'Everyone',2),(2,'Help',3),(3,'Technical Support',1),(4,'Chat User',4);
+INSERT INTO t2 VALUES
+(261,265,1),(490,494,1);
+SELECT t2.faq_id
+FROM t1 INNER JOIN t2 IGNORE INDEX (idx1)
+ON (t1.access_id = t2.access_id)
+LEFT JOIN t2 t
+ON (t.faq_group_id = t2.faq_group_id AND
+find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
+WHERE
+t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
+faq_id
+265
+SELECT t2.faq_id
+FROM t1 INNER JOIN t2
+ON (t1.access_id = t2.access_id)
+LEFT JOIN t2 t
+ON (t.faq_group_id = t2.faq_group_id AND
+find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
+WHERE
+t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
+faq_id
+265
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT, b INT, KEY inx (b,a));
+INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (1, 6), (1,7);
+EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2
+ON ( f1.b=f2.b AND f1.a<f2.a )
+WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE f1 index inx inx 10 NULL 7 Using where; Using index
+1 SIMPLE f2 ref inx inx 5 test.f1.b 1 Using where; Using index
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result
index 58ced16acac..0961ffd734c 100644
--- a/mysql-test/r/skip_grants.result
+++ b/mysql-test/r/skip_grants.result
@@ -58,3 +58,17 @@ DROP PROCEDURE p3;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
+set global event_scheduler=1;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED or --skip-grant-tables option so it cannot execute this statement
+select count(*) from information_schema.COLUMN_PRIVILEGES;
+count(*)
+0
+select count(*) from information_schema.SCHEMA_PRIVILEGES;
+count(*)
+0
+select count(*) from information_schema.TABLE_PRIVILEGES;
+count(*)
+0
+select count(*) from information_schema.USER_PRIVILEGES;
+count(*)
+0
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index 67b030f87a4..d56ad426585 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -187,7 +187,7 @@ Pos Instruction
32 set v_dig@4 (v_dig@4 + 1)
33 stmt 4 "update sudoku_work set dig = v_dig wh..."
34 set v_tcounter@6 (v_tcounter@6 + 1)
-35 jump_if_not 37(37) (not(`test`.`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
+35 jump_if_not 37(37) (not(`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
36 jump 15
37 set v_i@3 (v_i@3 + 1)
38 jump 15
@@ -621,3 +621,20 @@ Pos Instruction
0 stmt 2 "CREATE INDEX idx ON t1 (c1)"
DROP PROCEDURE p1;
End of 5.0 tests.
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dummy int default 0;
+CASE 12
+WHEN 12
+THEN SET dummy = 0;
+END CASE;
+END//
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 set dummy@0 0
+1 set_case_expr (6) 0 12
+2 jump_if_not 5(6) (case_expr@0 = 12)
+3 set dummy@0 0
+4 jump 6
+5 error 1339
+DROP PROCEDURE p1;
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 8c933927250..3dcdc46de2b 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -292,9 +292,9 @@ call p()|
unlock tables|
drop procedure p|
lock tables t1 read, mysql.proc write|
-ERROR HY000: You can't combine write-locking of system 'mysql.proc' table with other tables
+ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
lock tables mysql.proc write, mysql.user write|
-ERROR HY000: You can't combine write-locking of system 'mysql.proc' table with other tables
+ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
lock tables t1 read, mysql.proc read|
unlock tables|
lock tables mysql.proc write|
@@ -1414,3 +1414,55 @@ 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
+create procedure proc_26503_error_1()
+begin
+retry:
+repeat
+begin
+declare continue handler for sqlexception
+begin
+iterate retry;
+end
+select "do something";
+end
+until true end repeat retry;
+end//
+ERROR 42000: ITERATE with no matching label: retry
+create procedure proc_26503_error_2()
+begin
+retry:
+repeat
+begin
+declare continue handler for sqlexception
+iterate retry;
+select "do something";
+end
+until true end repeat retry;
+end//
+ERROR 42000: ITERATE with no matching label: retry
+create procedure proc_26503_error_3()
+begin
+retry:
+repeat
+begin
+declare continue handler for sqlexception
+begin
+leave retry;
+end
+select "do something";
+end
+until true end repeat retry;
+end//
+ERROR 42000: LEAVE with no matching label: retry
+create procedure proc_26503_error_4()
+begin
+retry:
+repeat
+begin
+declare continue handler for sqlexception
+leave retry;
+select "do something";
+end
+until true end repeat retry;
+end//
+ERROR 42000: LEAVE with no matching label: retry
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index b2fdf6a864e..7315ef40083 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -8,22 +8,29 @@ create procedure db1_secret.dummy() begin end;
drop procedure db1_secret.dummy;
use db1_secret;
create table t1 ( u varchar(64), i int );
+insert into t1 values('test', 0);
create procedure stamp(i int)
insert into db1_secret.t1 values (user(), i);
show procedure status like 'stamp';
Db Name Type Definer Modified Created Security_type Comment
db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
-create function db() returns varchar(64) return database();
+create function db() returns varchar(64)
+begin
+declare v varchar(64);
+select u into v from t1 limit 1;
+return v;
+end|
show function status like 'db';
Db Name Type Definer Modified Created Security_type Comment
db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
call stamp(1);
select * from t1;
u i
+test 0
root@localhost 1
select db();
db()
-db1_secret
+test
grant execute on procedure db1_secret.stamp to user1@'%';
grant execute on function db1_secret.db to user1@'%';
grant execute on procedure db1_secret.stamp to ''@'%';
@@ -31,25 +38,34 @@ grant execute on function db1_secret.db to ''@'%';
call db1_secret.stamp(2);
select db1_secret.db();
db1_secret.db()
-db1_secret
+test
select * from db1_secret.t1;
ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
drop procedure db1_secret.dummy;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
+drop procedure db1_secret.stamp;
+ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.stamp'
+drop function db1_secret.db;
+ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.db'
call db1_secret.stamp(3);
select db1_secret.db();
db1_secret.db()
-db1_secret
+test
select * from db1_secret.t1;
ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
drop procedure db1_secret.dummy;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
+drop procedure db1_secret.stamp;
+ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.stamp'
+drop function db1_secret.db;
+ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.db'
select * from t1;
u i
+test 0
root@localhost 1
user1@localhost 2
anon@localhost 3
@@ -64,21 +80,22 @@ db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 IN
call stamp(4);
select * from t1;
u i
+test 0
root@localhost 1
user1@localhost 2
anon@localhost 3
root@localhost 4
select db();
db()
-db1_secret
+test
call db1_secret.stamp(5);
-ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
+ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table 't1'
select db1_secret.db();
-ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
+ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
call db1_secret.stamp(6);
-ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
+ERROR 42000: INSERT command denied to user ''@'localhost' for table 't1'
select db1_secret.db();
-ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
+ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
drop database if exists db2;
create database db2;
use db2;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index c46558fb08f..44abc11029a 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -5398,7 +5398,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,
@@ -5617,6 +5617,32 @@ Called B
Called B
drop procedure proc_21462_a|
drop procedure proc_21462_b|
+DROP PROCEDURE IF EXISTS p1|
+DROP VIEW IF EXISTS v1, v2|
+DROP TABLE IF EXISTS t3, t4|
+CREATE TABLE t3 (t3_id INT)|
+INSERT INTO t3 VALUES (0)|
+INSERT INTO t3 VALUES (1)|
+CREATE TABLE t4 (t4_id INT)|
+INSERT INTO t4 VALUES (2)|
+CREATE VIEW v1 AS
+SELECT t3.t3_id, t4.t4_id
+FROM t3 JOIN t4 ON t3.t3_id = 0|
+CREATE VIEW v2 AS
+SELECT t3.t3_id AS t3_id_1, v1.t3_id AS t3_id_2, v1.t4_id
+FROM t3 LEFT JOIN v1 ON t3.t3_id = 0|
+CREATE PROCEDURE p1() SELECT * FROM v2|
+CALL p1()|
+t3_id_1 t3_id_2 t4_id
+0 0 2
+1 NULL NULL
+CALL p1()|
+t3_id_1 t3_id_2 t4_id
+0 0 2
+1 NULL NULL
+DROP PROCEDURE p1|
+DROP VIEW v1, v2|
+DROP TABLE t3, t4|
End of 5.0 tests
Begin of 5.1 tests
drop function if exists pi;
@@ -5857,6 +5883,171 @@ func_8407_b()
1500
drop function func_8407_a|
drop function func_8407_b|
+drop table if exists table_26503|
+drop procedure if exists proc_26503_ok_1|
+drop procedure if exists proc_26503_ok_2|
+drop procedure if exists proc_26503_ok_3|
+drop procedure if exists proc_26503_ok_4|
+create table table_26503(a int unique)|
+create procedure proc_26503_ok_1(v int)
+begin
+declare i int default 5;
+declare continue handler for sqlexception
+begin
+select 'caught something';
+retry:
+while i > 0 do
+begin
+set i = i - 1;
+select 'looping', i;
+iterate retry;
+select 'dead code';
+end;
+end while retry;
+select 'leaving handler';
+end;
+select 'do something';
+insert into table_26503 values (v);
+select 'do something again';
+insert into table_26503 values (v);
+end|
+create procedure proc_26503_ok_2(v int)
+begin
+declare i int default 5;
+declare continue handler for sqlexception
+begin
+select 'caught something';
+retry:
+while i > 0 do
+begin
+set i = i - 1;
+select 'looping', i;
+leave retry;
+select 'dead code';
+end;
+end while;
+select 'leaving handler';
+end;
+select 'do something';
+insert into table_26503 values (v);
+select 'do something again';
+insert into table_26503 values (v);
+end|
+create procedure proc_26503_ok_3(v int)
+begin
+declare i int default 5;
+retry:
+begin
+declare continue handler for sqlexception
+begin
+select 'caught something';
+retry:
+while i > 0 do
+begin
+set i = i - 1;
+select 'looping', i;
+iterate retry;
+select 'dead code';
+end;
+end while retry;
+select 'leaving handler';
+end;
+select 'do something';
+insert into table_26503 values (v);
+select 'do something again';
+insert into table_26503 values (v);
+end;
+end|
+create procedure proc_26503_ok_4(v int)
+begin
+declare i int default 5;
+retry:
+begin
+declare continue handler for sqlexception
+begin
+select 'caught something';
+retry:
+while i > 0 do
+begin
+set i = i - 1;
+select 'looping', i;
+leave retry;
+select 'dead code';
+end;
+end while;
+select 'leaving handler';
+end;
+select 'do something';
+insert into table_26503 values (v);
+select 'do something again';
+insert into table_26503 values (v);
+end;
+end|
+call proc_26503_ok_1(1)|
+do something
+do something
+do something again
+do something again
+caught something
+caught something
+looping i
+looping 4
+looping i
+looping 3
+looping i
+looping 2
+looping i
+looping 1
+looping i
+looping 0
+leaving handler
+leaving handler
+call proc_26503_ok_2(2)|
+do something
+do something
+do something again
+do something again
+caught something
+caught something
+looping i
+looping 4
+leaving handler
+leaving handler
+call proc_26503_ok_3(3)|
+do something
+do something
+do something again
+do something again
+caught something
+caught something
+looping i
+looping 4
+looping i
+looping 3
+looping i
+looping 2
+looping i
+looping 1
+looping i
+looping 0
+leaving handler
+leaving handler
+call proc_26503_ok_4(4)|
+do something
+do something
+do something again
+do something again
+caught something
+caught something
+looping i
+looping 4
+leaving handler
+leaving handler
+drop table table_26503|
+drop procedure proc_26503_ok_1|
+drop procedure proc_26503_ok_2|
+drop procedure proc_26503_ok_3|
+drop procedure proc_26503_ok_4|
DROP FUNCTION IF EXISTS bug25373|
CREATE FUNCTION bug25373(p1 INTEGER) RETURNS INTEGER
LANGUAGE SQL DETERMINISTIC
@@ -5870,4 +6061,129 @@ SUM(f2) bug25373(f1)
21.300000071526 NULL
DROP FUNCTION bug25373|
DROP TABLE t3|
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+CREATE DATABASE mysqltest1|
+CREATE DATABASE mysqltest2|
+CREATE PROCEDURE mysqltest1.p1()
+DROP DATABASE mysqltest2|
+use mysqltest2|
+CALL mysqltest1.p1()|
+Warnings:
+Note 1049 Unknown database 'mysqltest2'
+SELECT DATABASE()|
+DATABASE()
+NULL
+DROP DATABASE mysqltest1|
+use test|
+drop function if exists bug20777|
+drop table if exists examplebug20777|
+create function bug20777(f1 bigint unsigned) returns bigint unsigned
+begin
+set f1 = (f1 - 10); set f1 = (f1 + 10);
+return f1;
+end|
+select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
+9223372036854775803 2**63-5
+9223372036854775803
+select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
+9223372036854775804 2**63-4
+9223372036854775804
+select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
+9223372036854775805 2**63-3
+9223372036854775805
+select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
+9223372036854775806 2**63-2
+9223372036854775806
+select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
+9223372036854775807 2**63-1
+9223372036854775807
+select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
+9223372036854775808 2**63+0
+9223372036854775808
+select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
+9223372036854775809 2**63+1
+9223372036854775809
+select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
+9223372036854775810 2**63+2
+9223372036854775810
+select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
+lower bounds signed bigint
+0
+select bug20777(9223372036854775807) as 'upper bounds signed bigint';
+upper bounds signed bigint
+9223372036854775807
+select bug20777(0) as 'lower bounds unsigned bigint';
+lower bounds unsigned bigint
+0
+select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
+upper bounds unsigned bigint
+18446744073709551615
+select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
+upper bounds unsigned bigint + 1
+18446744073709551615
+select bug20777(-1) as 'lower bounds unsigned bigint - 1';
+lower bounds unsigned bigint - 1
+0
+create table examplebug20777 as select
+0 as 'i',
+bug20777(9223372036854775806) as '2**63-2',
+bug20777(9223372036854775807) as '2**63-1',
+bug20777(9223372036854775808) as '2**63',
+bug20777(9223372036854775809) as '2**63+1',
+bug20777(18446744073709551614) as '2**64-2',
+bug20777(18446744073709551615) as '2**64-1',
+bug20777(18446744073709551616) as '2**64',
+bug20777(0) as '0',
+bug20777(-1) as '-1';
+insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
+show create table examplebug20777;
+Table Create Table
+examplebug20777 CREATE TABLE `examplebug20777` (
+ `i` int(1) NOT NULL DEFAULT '0',
+ `2**63-2` bigint(20) unsigned DEFAULT NULL,
+ `2**63-1` bigint(20) unsigned DEFAULT NULL,
+ `2**63` bigint(20) unsigned DEFAULT NULL,
+ `2**63+1` bigint(20) unsigned DEFAULT NULL,
+ `2**64-2` bigint(20) unsigned DEFAULT NULL,
+ `2**64-1` bigint(20) unsigned DEFAULT NULL,
+ `2**64` bigint(20) unsigned DEFAULT NULL,
+ `0` bigint(20) unsigned DEFAULT NULL,
+ `-1` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from examplebug20777 order by i;
+i 2**63-2 2**63-1 2**63 2**63+1 2**64-2 2**64-1 2**64 0 -1
+0 9223372036854775806 9223372036854775807 9223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 18446744073709551615 0 0
+1 9223372036854775806 9223372036854775807 223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 8446744073709551616 0 0
+drop table examplebug20777;
+select bug20777(18446744073709551613)+1;
+bug20777(18446744073709551613)+1
+18446744073709551614
+drop function bug20777;
+End of 5.0 tests.
+drop table t1,t2;
+CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
+CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
+set @a=0;
+CREATE function bug27354() RETURNS int deterministic
+begin
+insert into t1 values (null);
+set @a=@a+1;
+return @a;
+end|
+update t2 set b=1 where a=bug27354();
+select count(t_1.a),count(t_2.a) from t1 as t_1, t2 as t_2 /* must be 0,0 */;
+count(t_1.a) count(t_2.a)
+0 0
+insert into t2 values (1,1),(2,2),(3,3);
+update t2 set b=-b where a=bug27354();
+select * from t2 /* must return 1,-1 ... */;
+a b
+1 -1
+2 -2
+3 -3
+select count(*) from t1 /* must be 3 */;
+count(*)
+3
drop table t1,t2;
+drop function bug27354;
diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result
new file mode 100644
index 00000000000..a835b06858b
--- /dev/null
+++ b/mysql-test/r/sp_trans_log.result
@@ -0,0 +1,27 @@
+drop function if exists bug23333|
+drop table if exists t1,t2|
+CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
+CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
+insert into t2 values (1,1)|
+create function bug23333()
+RETURNS int(11)
+DETERMINISTIC
+begin
+insert into t1 values (null);
+select count(*) from t1 into @a;
+return @a;
+end|
+reset master|
+insert into t2 values (bug23333(),1)|
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+show binlog events from 106 /* with fixes for #23333 will show there is the query */|
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Query 1 # #
+select count(*),@a from t1 /* must be 1,1 */|
+count(*) @a
+1 1
+drop table t1,t2;
+drop function if exists bug23333;
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index 0e21ff80e29..94f4637cd05 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -7,7 +7,6 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
INSERT INTO t1 VALUES('0000-10-31');
-ERROR 22007: Incorrect date value: '0000-10-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31');
ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31');
@@ -57,6 +56,7 @@ select * from t1;
col1
2004-01-01
2004-02-29
+0000-10-31
2004-01-02
2004-01-03
2004-00-31
@@ -124,7 +124,6 @@ set @@sql_mode='ansi,traditional';
CREATE TABLE t1 (col1 datetime);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
INSERT INTO t1 VALUES('0000-10-31 15:30:00');
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
@@ -145,6 +144,7 @@ select * from t1;
col1
2004-10-31 15:30:00
2004-02-29 15:30:00
+0000-10-31 15:30:00
drop table t1;
CREATE TABLE t1 (col1 timestamp);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
@@ -206,7 +206,8 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect date value: '0000-10-31 15:30:00' for column 'col1' at row 1
+Warnings:
+Note 1265 Data truncated for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -222,7 +223,6 @@ ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_ti
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -259,7 +259,6 @@ 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: 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));
@@ -267,7 +266,6 @@ 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: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-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));
@@ -275,7 +273,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
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));
@@ -288,7 +286,6 @@ 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: 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));
@@ -296,7 +293,6 @@ 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: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-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));
@@ -304,7 +300,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
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));
@@ -1352,3 +1348,49 @@ t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*'
drop table t1;
+set sql_mode= 'traditional';
+create table t1(col1 tinyint, col2 tinyint unsigned,
+col3 smallint, col4 smallint unsigned,
+col5 mediumint, col6 mediumint unsigned,
+col7 int, col8 int unsigned,
+col9 bigint, col10 bigint unsigned);
+insert into t1(col1) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col1' at row 1
+insert into t1(col2) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col2' at row 1
+insert into t1(col3) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col3' at row 1
+insert into t1(col4) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col4' at row 1
+insert into t1(col5) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col5' at row 1
+insert into t1(col6) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col6' at row 1
+insert into t1(col7) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col7' at row 1
+insert into t1(col8) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col8' at row 1
+insert into t1(col9) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col9' at row 1
+insert into t1(col10) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col10' at row 1
+drop table t1;
+set sql_mode='traditional';
+create table t1(a year);
+insert into t1 values ('-');
+ERROR HY000: Incorrect integer value: '-' for column 'a' at row 1
+insert into t1 values ('+');
+ERROR HY000: Incorrect integer value: '+' for column 'a' at row 1
+insert into t1 values ('');
+ERROR HY000: Incorrect integer value: '' for column 'a' at row 1
+insert into t1 values ('2000a');
+ERROR 01000: Data truncated for column 'a' at row 1
+insert into t1 values ('2E3x');
+ERROR 01000: Data truncated for column 'a' at row 1
+drop table t1;
+set sql_mode='traditional';
+create table t1 (f1 set('a','a'));
+ERROR HY000: Column 'f1' has duplicated value 'a' in SET
+create table t1 (f1 enum('a','a'));
+ERROR HY000: Column 'f1' has duplicated value 'a' in ENUM
+End of 5.0 tests
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 2afdd045203..8263350fe58 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -48,7 +48,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
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
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1' AS `a`) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
@@ -330,7 +330,7 @@ patient_uq clinic_uq
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 filtered Extra
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where
-2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 t6.clinic_uq 1 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t6.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`))
@@ -1741,7 +1741,7 @@ Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `tes
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 filtered Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
-2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 tt.id 1 100.00 Using where; Using index
+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 'test.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))))
@@ -3712,12 +3712,6 @@ bb 2
cc 3
dd 1
DROP TABLE t1,t2,t3;
-CREATE TABLE t1 (s1 char(1));
-INSERT INTO t1 VALUES ('a');
-SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
-s1
-a
-DROP TABLE t1;
CREATE TABLE t1(f1 int);
CREATE TABLE t2(f2 int, f21 int, f3 timestamp);
INSERT INTO t1 VALUES (1),(1),(2),(2);
@@ -3873,3 +3867,154 @@ id_1
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t1xt2;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (3), (1), (2);
+SELECT 'this is ' 'a test.' AS col1, a AS col2 FROM t1;
+col1 col2
+this is a test. 3
+this is a test. 1
+this is a test. 2
+SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
+col1 t2
+this is a test. 3
+this is a test. 1
+this is a test. 2
+DROP table t1;
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (m int, n int);
+INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
+INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
+SELECT COUNT(*), a,
+(SELECT m FROM t2 WHERE m = count(*) LIMIT 1)
+FROM t1 GROUP BY a;
+COUNT(*) a (SELECT m FROM t2 WHERE m = count(*) LIMIT 1)
+2 2 2
+3 3 3
+1 4 1
+SELECT COUNT(*), a,
+(SELECT MIN(m) FROM t2 WHERE m = count(*))
+FROM t1 GROUP BY a;
+COUNT(*) a (SELECT MIN(m) FROM t2 WHERE m = count(*))
+2 2 2
+3 3 3
+1 4 1
+SELECT COUNT(*), a
+FROM t1 GROUP BY a
+HAVING (SELECT MIN(m) FROM t2 WHERE m = count(*)) > 1;
+COUNT(*) a
+2 2
+3 3
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (m int, n int);
+INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
+INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
+SELECT COUNT(*) c, a,
+(SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a)
+FROM t1 GROUP BY a;
+c a (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a)
+2 2 2
+3 3 3
+1 4 1,1
+SELECT COUNT(*) c, a,
+(SELECT GROUP_CONCAT(COUNT(a)+1) FROM t2 WHERE m = a)
+FROM t1 GROUP BY a;
+c a (SELECT GROUP_CONCAT(COUNT(a)+1) FROM t2 WHERE m = a)
+2 2 3
+3 3 4
+1 4 2,2
+DROP table t1,t2;
+CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
+INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
+(1,5,0,'e'), (2,1,0,'f'), (2,2,0,'g'), (2,3,0,'h'), (3,4,0,'i'), (3,3,0,'j'),
+(3,2,0,'k'), (3,1,0,'l'), (1,9,0,'m'), (1,0,10,'n'), (2,0,5,'o'), (3,0,7,'p');
+SELECT a, MAX(b),
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
+FROM t1 GROUP BY a;
+a MAX(b) test
+1 9 m
+2 3 h
+3 4 i
+SELECT a x, MAX(b),
+(SELECT t.c FROM t1 AS t WHERE x=t.a AND t.b=MAX(t1.b + 0)) as test
+FROM t1 GROUP BY a;
+x MAX(b) test
+1 9 m
+2 3 h
+3 4 i
+SELECT a, AVG(b),
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test
+FROM t1 WHERE t1.d=0 GROUP BY a;
+a AVG(b) test
+1 4.0000 d
+2 2.0000 g
+3 2.5000 NULL
+SELECT tt.a,
+(SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+FROM t1 as tt;
+a test
+1 n
+1 n
+1 n
+1 n
+1 n
+1 n
+1 n
+2 o
+2 o
+2 o
+2 o
+3 p
+3 p
+3 p
+3 p
+3 p
+SELECT tt.a,
+(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+LIMIT 1)
+FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+FROM t1 as tt GROUP BY tt.a;
+a test
+1 n
+2 o
+3 p
+SELECT tt.a, MAX(
+(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+LIMIT 1)
+FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
+FROM t1 as tt GROUP BY tt.a;
+a test
+1 n
+2 o
+3 p
+DROP TABLE t1;
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
+a
+1
+2
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
+a
+SELECT a FROM t1 t0
+WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
+a
+1
+2
+SET @@sql_mode='ansi';
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
+ERROR HY000: Invalid use of group function
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
+ERROR HY000: Invalid use of group function
+SELECT a FROM t1 t0
+WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
+ERROR HY000: Invalid use of group function
+SET @@sql_mode=default;
+DROP TABLE t1;
+CREATE TABLE t1 (s1 char(1));
+INSERT INTO t1 VALUES ('a');
+SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
+s1
+a
+DROP TABLE t1;
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index 03c35d51045..18feb7cb6b9 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -432,7 +432,7 @@ alter table t1 add index idx(oref,ie);
explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 7
-2 DEPENDENT SUBQUERY t1 ref_or_null idx idx 10 t2.oref,func 4 Using where; Using index; Full scan on NULL key
+2 DEPENDENT SUBQUERY t1 ref_or_null idx idx 10 test.t2.oref,func 4 Using where; Using index; Full scan on NULL key
select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
oref a Z
ee NULL NULL
@@ -457,7 +457,7 @@ group by grp having min(ie) > 1) Z
from t2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 7
-2 DEPENDENT SUBQUERY t1 ref idx idx 5 t2.oref 2 Using where; Using temporary; Using filesort
+2 DEPENDENT SUBQUERY t1 ref idx idx 5 test.t2.oref 2 Using where; Using temporary; Using filesort
select oref, a,
a in (select min(ie) from t1 where oref=t2.oref
group by grp having min(ie) > 1) Z
@@ -645,3 +645,50 @@ a b Z
2 2 0
3 3 1
drop table t1,t2;
+CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
+INSERT INTO t1 VALUES (1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
+(2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'),(3,3,'j'), (3,2,'k'), (3,1,'l'),
+(1,9,'m');
+CREATE TABLE t2 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
+INSERT INTO t2 SELECT * FROM t1;
+SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b))
+as test FROM t1 GROUP BY a;
+a MAX(b) test
+1 9 m
+2 3 h
+3 4 i
+SELECT * FROM t1 GROUP by t1.a
+HAVING (MAX(t1.b) > (SELECT MAX(t2.b) FROM t2 WHERE t2.c < t1.c
+HAVING MAX(t2.b+t1.a) < 10));
+a b c
+SELECT a,b,c FROM t1 WHERE b in (9,3,4) ORDER BY b,c;
+a b c
+1 3 c
+2 3 h
+3 3 j
+1 4 d
+3 4 i
+1 9 m
+SELECT a, MAX(b),
+(SELECT COUNT(DISTINCT t.c) FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)
+LIMIT 1)
+as cnt,
+(SELECT t.b FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1)
+as t_b,
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1)
+as t_b,
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) ORDER BY t.c LIMIT 1)
+as t_b
+FROM t1 GROUP BY a;
+a MAX(b) cnt t_b t_b t_b
+1 9 1 9 m m
+2 3 1 3 h h
+3 4 1 4 i i
+SELECT a, MAX(b),
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as test
+FROM t1 GROUP BY a;
+a MAX(b) test
+1 9 m
+2 3 h
+3 4 i
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index c93fbfba6e2..5acbace480a 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -220,10 +220,12 @@ event CREATE TABLE `event` (
`last_executed` datetime DEFAULT NULL,
`starts` datetime DEFAULT NULL,
`ends` datetime DEFAULT NULL,
- `status` enum('ENABLED','DISABLED') NOT NULL DEFAULT 'ENABLED',
+ `status` enum('ENABLED','DISABLED','SLAVESIDE_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 '',
+ `originator` int(10) NOT NULL,
+ `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
show create table general_log;
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 6c9a389c1f4..9cb4a6b2427 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -152,6 +152,27 @@ SELECT * FROM t1;
i
DROP TABLE t1;
End of 4.1 tests.
+CREATE TABLE t1 ( c FLOAT( 20, 14 ) );
+INSERT INTO t1 VALUES( 12139 );
+CREATE TABLE t2 ( c FLOAT(30,18) );
+INSERT INTO t2 VALUES( 123456 );
+SELECT AVG( c ) FROM t1 UNION SELECT 1;
+AVG( c )
+12139
+1
+SELECT 1 UNION SELECT AVG( c ) FROM t1;
+1
+1
+12139
+SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1;
+1
+1
+123456
+SELECT c/1 FROM t1 UNION SELECT 1;
+c/1
+12139
+1
+DROP TABLE t1, t2;
create temporary table t1 (a int);
insert into t1 values (4711);
select * from t1;
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
index f7631e9657a..32db7ea7fa9 100644
--- a/mysql-test/r/timezone2.result
+++ b/mysql-test/r/timezone2.result
@@ -285,3 +285,14 @@ ldt ldt2
drop table t1;
drop function f1;
SET GLOBAL log_bin_trust_function_creators = 0;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (t TIMESTAMP);
+INSERT INTO t1 VALUES (NULL), (NULL);
+LOCK TABLES t1 WRITE;
+SELECT CONVERT_TZ(NOW(), 'UTC', 'Europe/Moscow') IS NULL;
+CONVERT_TZ(NOW(), 'UTC', 'Europe/Moscow') IS NULL
+0
+UPDATE t1 SET t = CONVERT_TZ(t, 'UTC', 'Europe/Moscow');
+UNLOCK TABLES;
+DROP TABLE t1;
+End of 5.1 tests
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index e5d1b5a3f1f..c24f7b6b06f 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -1372,4 +1372,46 @@ INSERT INTO bug22580_t1 VALUES (1,1);
DROP TABLE bug22580_t1;
DROP PROCEDURE bug22580_proc_1;
DROP PROCEDURE bug22580_proc_2;
+DROP TRIGGER IF EXISTS trg27006_a_update;
+DROP TRIGGER IF EXISTS trg27006_a_insert;
+CREATE TABLE t1 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`val` varchar(10) NOT NULL,
+PRIMARY KEY (`id`)
+);
+CREATE TABLE t2 like t1;
+CREATE TRIGGER trg27006_a_insert AFTER INSERT ON t1 FOR EACH ROW
+BEGIN
+insert into t2 values (NULL,new.val);
+END |
+CREATE TRIGGER trg27006_a_update AFTER UPDATE ON t1 FOR EACH ROW
+BEGIN
+insert into t2 values (NULL,new.val);
+END |
+INSERT INTO t1(val) VALUES ('test1'),('test2');
+SELECT * FROM t1;
+id val
+1 test1
+2 test2
+SELECT * FROM t2;
+id val
+1 test1
+2 test2
+INSERT INTO t1 VALUES (2,'test2') ON DUPLICATE KEY UPDATE val=VALUES(val);
+INSERT INTO t1 VALUES (2,'test3') ON DUPLICATE KEY UPDATE val=VALUES(val);
+INSERT INTO t1 VALUES (3,'test4') ON DUPLICATE KEY UPDATE val=VALUES(val);
+SELECT * FROM t1;
+id val
+1 test1
+2 test3
+3 test4
+SELECT * FROM t2;
+id val
+1 test1
+2 test2
+3 test3
+4 test4
+DROP TRIGGER trg27006_a_insert;
+DROP TRIGGER trg27006_a_update;
+drop table t1,t2;
End of 5.0 tests
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index 74a6cb72cc6..6c21db0e2b8 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -53,3 +53,30 @@ a
3
4
drop table t1;
+create table t1 (s1 int);
+insert into t1 (s1) values (1), (2), (3), (4), (5);
+create view v1 as select * from t1;
+truncate table v1;
+select count(*) from t1;
+count(*)
+0
+insert into t1 (s1) values (1), (2), (3), (4), (5);
+create view v2 as select * from t1 where s1 > 3;
+truncate table v2;
+select * from t1;
+s1
+1
+2
+3
+select * from v2;
+s1
+delete from t1;
+create table t2 (s1 int, s2 int);
+create view v3 as select a.s1, b.s2 from t1 a join t2 b on a.s1 = b.s1 where a.s1 > 3;
+truncate table v3;
+ERROR HY000: Can not delete from join view 'test.v3'
+create view v4 as select * from t1 limit 1,1;
+truncate table v4;
+ERROR HY000: The target table v4 of the TRUNCATE is not updatable
+drop view v1, v2, v3, v4;
+drop table t1, t2;
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 12ce742eab4..6d5218873ce 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 for column 'y' at row 1
+Warning 1366 Incorrect integer value: 'abc' for column 'y' at row 1
SELECT * FROM t1;
y
0000
@@ -110,3 +110,29 @@ select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_dat
1
1
drop table t1;
+select @d:=1111, year(@d), month(@d), day(@d), cast(@d as date);
+@d:=1111 year(@d) month(@d) day(@d) cast(@d as date)
+1111 2000 11 11 2000-11-11
+select @d:=011111, year(@d), month(@d), day(@d), cast(@d as date);
+@d:=011111 year(@d) month(@d) day(@d) cast(@d as date)
+11111 2001 11 11 2001-11-11
+select @d:=1311, year(@d), month(@d), day(@d), cast(@d as date);
+@d:=1311 year(@d) month(@d) day(@d) cast(@d as date)
+1311 NULL NULL NULL NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '1311'
+Warning 1292 Incorrect datetime value: '1311'
+Warning 1292 Incorrect datetime value: '1311'
+Warning 1292 Incorrect datetime value: '1311'
+create table t1 (d date , dt datetime , ts timestamp);
+insert into t1 values (9912101,9912101,9912101);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'dt' at row 1
+Warning 1265 Data truncated for column 'ts' at row 1
+insert into t1 values (11111,11111,11111);
+select * from t1;
+d dt ts
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00
+2001-11-11 2001-11-11 00:00:00 2001-11-11 00:00:00
+drop table t1;
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index a8d5388097d..045a6cd1c0a 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -26,8 +26,6 @@ Table Op Msg_type Msg_text
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 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;
@@ -36,7 +34,7 @@ t
2069-12-31 00:00:00
1970-01-01 00:00:00
1999-12-31 00:00:00
-0000-00-00 00:00:00
+0000-01-01 00:00:00
0001-01-01 00:00:00
9999-12-31 00:00:00
2000-10-10 00:00:00
@@ -168,6 +166,9 @@ dt
0000-00-00 00:00:00
0000-00-00 00:00:00
drop table t1;
+select cast('2006-12-05 22:10:10' as datetime) + 0;
+cast('2006-12-05 22:10:10' as datetime) + 0
+20061205221010.000000
CREATE TABLE t1(a DATETIME NOT NULL);
INSERT INTO t1 VALUES ('20060606155555');
SELECT a FROM t1 WHERE a=(SELECT MAX(a) FROM t1) AND (a="20060606155555");
@@ -191,3 +192,38 @@ CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMA
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6))
101112.098700
+set @org_mode=@@sql_mode;
+create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
+Warnings:
+Note 1265 Data truncated for column 'da' at row 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `da` date DEFAULT '1962-03-03',
+ `dt` datetime DEFAULT '1962-03-03 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ();
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+Warnings:
+Note 1265 Data truncated for column 'da' at row 1
+set @@sql_mode='ansi,traditional';
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+Warnings:
+Note 1265 Data truncated for column 'da' at row 1
+insert into t1 set dt='2007-03-23 13:49:38',da=dt;
+Warnings:
+Note 1265 Data truncated for column 'da' at row 1
+insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
+ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1
+select * from t1;
+da dt
+1962-03-03 1962-03-03 00:00:00
+2007-03-23 2007-03-23 13:49:38
+2007-03-23 2007-03-23 13:49:38
+2007-03-23 2007-03-23 13:49:38
+drop table t1;
+create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
+ERROR 42000: Invalid default value for 'da'
+create table t1 (t time default '916:00:00 a');
+ERROR 42000: Invalid default value for 't'
+set @@sql_mode= @org_mode;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index dbe60aff3d9..ac1270d33a0 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -92,7 +92,7 @@ show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`col1` double DEFAULT NULL,
- `col2` double(53,5) DEFAULT NULL,
+ `col2` double(22,5) DEFAULT NULL,
`col3` double DEFAULT NULL,
`col4` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -232,12 +232,12 @@ insert into t2 values ("1.23456780");
create table t3 select * from t2 union select * from t1;
select * from t3;
d
-1.234567800
-100000000.000000000
+1.2345678
+100000000
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `d` double(22,9) DEFAULT NULL
+ `d` double 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_newdecimal.result b/mysql-test/r/type_newdecimal.result
index 901297288af..f3c7e45de39 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -1428,6 +1428,19 @@ f1
20101112000000.000014
101112.000000
drop table t1;
+select cast(19999999999999999999 as unsigned);
+cast(19999999999999999999 as unsigned)
+18446744073709551615
+Warnings:
+Error 1292 Truncated incorrect DECIMAL value: ''
+create table t1(a decimal(18));
+insert into t1 values(123456789012345678);
+alter table t1 modify column a decimal(19);
+select * from t1;
+a
+123456789012345678
+drop table t1;
+End of 5.0 tests
select cast(143.481 as decimal(4,1));
cast(143.481 as decimal(4,1))
143.5
@@ -1455,8 +1468,3 @@ 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
-select cast(19999999999999999999 as unsigned);
-cast(19999999999999999999 as unsigned)
-18446744073709551615
-Warnings:
-Error 1292 Truncated incorrect DECIMAL value: ''
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index 36022383f1b..877400ab7e1 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -66,3 +66,22 @@ ss
ue
ue
DROP TABLE t1;
+create table t1(f1
+set('1','2','3','4','5','6','7','8','9','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','54','55','56','57','58','59','60','61','62','63','64','128'));
+ERROR HY000: Too many strings for column f1 and SET
+create table t1(f1
+set('1','2','3','4','5','6','7','8','9','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','54','55','56','57','58','59','60','61','62','63','64','1'));
+Warnings:
+Note 1291 Column 'f1' has duplicated value '1' in SET
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` set('1','2','3','4','5','6','7','8','9','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','54','55','56','57','58','59','60','61','62','63','64','1') DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index 84b688429db..e52947455c8 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -34,3 +34,15 @@ select if(y = now(), 1, 0) from t1;
if(y = now(), 1, 0)
1
drop table t1;
+create table t1(a year);
+insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
+select * from t1;
+a
+2001
+2001
+2001
+2001
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index 593ac63ca80..c7a9b0982a9 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -159,7 +159,7 @@ EXPLAIN EXTENDED SELECT myfunc_int(fn(MIN(b))) as c FROM t1 GROUP BY a;
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 temporary; Using filesort
Warnings:
-Note 1003 select myfunc_int(`test`.`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a`
+Note 1003 select myfunc_int(`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a`
EXPLAIN EXTENDED SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a;
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 temporary; Using filesort
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 2c33ffc08d7..275f3357c65 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -554,7 +554,7 @@ aa
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(20) NOT NULL DEFAULT ''
+ `a` varbinary(2) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT 12 as a UNION select 12.2 as a;
@@ -655,7 +655,7 @@ f
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f` varbinary(24) DEFAULT NULL
+ `f` varbinary(12) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT y from t2 UNION select da from t2;
@@ -1437,4 +1437,12 @@ a
SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test;
ERROR 42S22: Unknown column 'c' in 'order clause'
DROP TABLE t1;
+(select 1 into @var) union (select 1);
+ERROR HY000: Incorrect usage of UNION and INTO
+(select 1) union (select 1 into @var);
+select @var;
+@var
+1
+(select 2) union (select 1 into @var);
+ERROR 42000: Result consisted of more than one row
End of 5.0 tests
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index 1c50289a85d..b76b399c9e2 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 102;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-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)
+master-bin.000001 # User var # # @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(@`a b`)
+master-bin.000001 # User var # # @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
+master-bin.000001 # User var # # @`var2`=_binary 0x61 COLLATE binary
+master-bin.000001 # Query # # use `test`; insert into t1 values (@var1),(@var2)
flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 6927f07da6b..8d601596648 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -753,6 +753,37 @@ set lc_time_names=0;
select @@lc_time_names;
@@lc_time_names
en_US
+select @@global.lc_time_names, @@lc_time_names;
+@@global.lc_time_names @@lc_time_names
+en_US en_US
+set @@global.lc_time_names=fr_FR;
+select @@global.lc_time_names, @@lc_time_names;
+@@global.lc_time_names @@lc_time_names
+fr_FR en_US
+New connection
+select @@global.lc_time_names, @@lc_time_names;
+@@global.lc_time_names @@lc_time_names
+fr_FR fr_FR
+set @@lc_time_names=ru_RU;
+select @@global.lc_time_names, @@lc_time_names;
+@@global.lc_time_names @@lc_time_names
+fr_FR ru_RU
+Returnung to default connection
+select @@global.lc_time_names, @@lc_time_names;
+@@global.lc_time_names @@lc_time_names
+fr_FR en_US
+set lc_time_names=default;
+select @@global.lc_time_names, @@lc_time_names;
+@@global.lc_time_names @@lc_time_names
+fr_FR fr_FR
+set @@global.lc_time_names=default;
+select @@global.lc_time_names, @@lc_time_names;
+@@global.lc_time_names @@lc_time_names
+en_US fr_FR
+set @@lc_time_names=default;
+select @@global.lc_time_names, @@lc_time_names;
+@@global.lc_time_names @@lc_time_names
+en_US en_US
set @test = @@query_prealloc_size;
set @@query_prealloc_size = @test;
select @@query_prealloc_size = @test;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index bc0906b07f3..a542d3270a2 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -900,6 +900,7 @@ drop view v1;
drop table t1;
create table t1 (col1 int);
create table t2 (col1 int);
+create table t3 (col1 datetime not null);
create view v1 as select * from t1;
create view v2 as select * from v1;
create view v3 as select v2.col1 from v2,t2 where v2.col1 = t2.col1;
@@ -1004,8 +1005,8 @@ ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v3
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2));
ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v3'.
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
-insert into mysql.time_zone values ('', (select CONVERT_TZ('20050101000000','UTC','MET') from t2));
-ERROR 23000: Column 'Use_leap_seconds' cannot be null
+insert into t3 values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
+ERROR 23000: Column 'col1' cannot be null
create algorithm=temptable view v4 as select * from t1;
insert into t1 values (1),(2),(3);
insert into t1 (col1) values ((select max(col1) from v4));
@@ -1017,7 +1018,7 @@ NULL
3
3
drop view v4,v3,v2,v1;
-drop table t1,t2;
+drop table t1,t2,t3;
create table t1 (s1 int);
create view v1 as select * from t1;
handler v1 open as xx;
@@ -2384,6 +2385,16 @@ Table Op Msg_type Msg_text
test.v1 optimize error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
+ANALYZE TABLE v1;
+Table Op Msg_type Msg_text
+test.v1 analyze error 'test.v1' is not BASE TABLE
+Warnings:
+Error 1347 'test.v1' is not BASE TABLE
+REPAIR TABLE v1;
+Table Op Msg_type Msg_text
+test.v1 repair error 'test.v1' is not BASE TABLE
+Warnings:
+Error 1347 'test.v1' is not BASE TABLE
DROP VIEW v1;
create definer = current_user() sql security invoker view v1 as select 1;
show create view v1;
@@ -3320,3 +3331,4 @@ DROP TABLE `t-2`;
DROP VIEW `v-2`;
DROP DATABASE `d-1`;
USE test;
+End of 5.1 tests.
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index a95184b8576..51d131f0044 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -284,15 +284,6 @@ create view mysqltest.v3 as select b from mysqltest.t2;
grant create view, update on mysqltest.v3 to mysqltest_1@localhost;
drop view mysqltest.v3;
create view mysqltest.v3 as select b from mysqltest.t2;
-grant create view, update, insert on mysqltest.v3 to mysqltest_1@localhost;
-drop view mysqltest.v3;
-create view mysqltest.v3 as select b from mysqltest.t2;
-ERROR 42000: create view command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 'v3'
-create table mysqltest.v3 (b int);
-grant select(b) on mysqltest.v3 to mysqltest_1@localhost;
-drop table mysqltest.v3;
-create view mysqltest.v3 as select b from mysqltest.t2;
-ERROR 42000: create view command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 'v3'
create view v4 as select b+1 from mysqltest.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2'
grant create view,update,select on test.* to mysqltest_1@localhost;
@@ -775,4 +766,146 @@ DROP DATABASE mysqltest_db1;
DROP DATABASE mysqltest_db2;
DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost;
+CREATE DATABASE db26813;
+USE db26813;
+CREATE TABLE t1(f1 INT, f2 INT);
+CREATE VIEW v1 AS SELECT f1 FROM t1;
+CREATE VIEW v2 AS SELECT f1 FROM t1;
+CREATE VIEW v3 AS SELECT f1 FROM t1;
+CREATE USER u26813@localhost;
+GRANT DROP ON db26813.v1 TO u26813@localhost;
+GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost;
+GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
+GRANT SELECT ON db26813.t1 TO u26813@localhost;
+ALTER VIEW v1 AS SELECT f2 FROM t1;
+ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1'
+ALTER VIEW v2 AS SELECT f2 FROM t1;
+ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2'
+ALTER VIEW v3 AS SELECT f2 FROM t1;
+SHOW CREATE VIEW v3;
+View Create View
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1`
+DROP USER u26813@localhost;
+DROP DATABASE db26813;
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE TABLE mysqltest1.t1(c1 INT);
+CREATE TABLE mysqltest1.t2(c2 INT);
+CREATE TABLE mysqltest1.t3(c3 INT);
+CREATE TABLE mysqltest1.t4(c4 INT);
+INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14);
+INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
+INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
+INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
+GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
+GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
+GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
+GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost;
+GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost;
+
+---> connection: bug24040_con
+SELECT * FROM mysqltest1.t1;
+c1
+11
+12
+13
+14
+INSERT INTO mysqltest1.t2 VALUES(25);
+UPDATE mysqltest1.t3 SET c3 = 331 WHERE c3 = 31;
+DELETE FROM mysqltest1.t4 WHERE c4 = 44;
+CREATE VIEW v1 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW v2 AS SELECT * FROM mysqltest1.t2;
+CREATE VIEW v3 AS SELECT * FROM mysqltest1.t3;
+CREATE VIEW v4 AS SELECT * FROM mysqltest1.t4;
+SELECT * FROM v1;
+c1
+11
+12
+13
+14
+INSERT INTO v2 VALUES(26);
+UPDATE v3 SET c3 = 332 WHERE c3 = 32;
+DELETE FROM v4 WHERE c4 = 43;
+CREATE VIEW v12 AS SELECT c1, c2 FROM mysqltest1.t1, mysqltest1.t2;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v12'
+CREATE VIEW v13 AS SELECT c1, c3 FROM mysqltest1.t1, mysqltest1.t3;
+CREATE VIEW v14 AS SELECT c1, c4 FROM mysqltest1.t1, mysqltest1.t4;
+CREATE VIEW v21 AS SELECT c2, c1 FROM mysqltest1.t2, mysqltest1.t1;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c1' in table 'v21'
+CREATE VIEW v23 AS SELECT c2, c3 FROM mysqltest1.t2, mysqltest1.t3;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c3' in table 'v23'
+CREATE VIEW v24 AS SELECT c2, c4 FROM mysqltest1.t2, mysqltest1.t4;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c4' in table 'v24'
+CREATE VIEW v31 AS SELECT c3, c1 FROM mysqltest1.t3, mysqltest1.t1;
+CREATE VIEW v32 AS SELECT c3, c2 FROM mysqltest1.t3, mysqltest1.t2;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v32'
+CREATE VIEW v34 AS SELECT c3, c4 FROM mysqltest1.t3, mysqltest1.t4;
+CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1;
+CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v42'
+CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3;
+
+---> connection: default
+SELECT * FROM mysqltest1.t1;
+c1
+11
+12
+13
+14
+SELECT * FROM mysqltest1.t2;
+c2
+21
+22
+23
+24
+25
+26
+SELECT * FROM mysqltest1.t3;
+c3
+331
+332
+33
+34
+SELECT * FROM mysqltest1.t4;
+c4
+41
+42
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP USER mysqltest_u1@localhost;
End of 5.0 tests.
+DROP VIEW IF EXISTS v1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+ALTER VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1`
+ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1;
+Warnings:
+Note 1449 There is no 'no_such'@'user_1' registered
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1`
+Warnings:
+Note 1449 There is no 'no_such'@'user_1' registered
+ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1`
+Warnings:
+Note 1449 There is no 'no_such'@'user_1' registered
+ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
+Warnings:
+Note 1449 There is no 'no_such'@'user_2' registered
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1`
+Warnings:
+Note 1449 There is no 'no_such'@'user_2' registered
+DROP VIEW v1;
+DROP TABLE t1;
+End of 5.1 tests.
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
index 7472b724f47..9f3828bff61 100644
--- a/mysql-test/r/windows.result
+++ b/mysql-test/r/windows.result
@@ -26,3 +26,18 @@ ERROR HY000: No paths allowed for shared library
execute abc;
ERROR HY000: No paths allowed for shared library
deallocate prepare abc;
+CREATE TABLE t1 (
+`pkid` int(11) NOT NULL AUTO_INCREMENT,
+`SALES_DATE` date NOT NULL DEFAULT '0000-00-00',
+KEY `pkid` (`pkid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+PARTITION BY RANGE (MONTH(SALES_DATE))
+(
+PARTITION p0 VALUES LESS THAN (2) ENGINE=INNODB
+data DIRECTORY='c:/tmp/'
+ index DIRECTORY = 'c:/tmp/',
+PARTITION p1 VALUES LESS THAN (3) ENGINE=INNODB
+data DIRECTORY='c:/tmp/'
+ index DIRECTORY = 'c:/tmp/'
+);
+DROP TABLE t1;
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index f5ef919fd93..77764e1bc1a 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -547,6 +547,13 @@ UpdateXML(@xml, '/a/b/@bb2', '')
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>
+select updatexml('<div><div><span>1</span><span>2</span></div></div>',
+'/','<tr><td>1</td><td>2</td></tr>') as upd1;
+upd1
+<tr><td>1</td><td>2</td></tr>
+select updatexml('', '/', '') as upd2;
+upd2
+
SET @xml= '<order><clerk>lesser wombat</clerk></order>';
select extractvalue(@xml,'order/clerk');
extractvalue(@xml,'order/clerk')
diff --git a/mysql-test/suite/funcs_1/r/a_version_check.result b/mysql-test/suite/funcs_1/r/a_version_check.result
index 1569c40e4e5..da6ba0846fd 100644
--- a/mysql-test/suite/funcs_1/r/a_version_check.result
+++ b/mysql-test/suite/funcs_1/r/a_version_check.result
@@ -6,6 +6,6 @@
. updated with each new version --- THIS IS INTENDED!
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-funcs_1 checked with version: 5.1.16
+funcs_1 checked with version: 5.1.17
Warnings:
Warning 1548 Leading spaces are removed from name ' '
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc b/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc
index f74fce39a7d..b2e102f8e07 100644
--- a/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc
@@ -1,7 +1,7 @@
################################################################################
-# t/partition_supported_sql_funcs.inc # #
+# t/partition_supported_sql_funcs.inc # # #
# Purpose: #
-# Tests around sql functions #
+# Tests frame for allowed sql functions #
# #
# #
#------------------------------------------------------------------------------#
@@ -83,24 +83,23 @@ eval insert into t3 values ($val1);
eval insert into t3 values ($val2);
eval insert into t3 values ($val3);
-eval insert into t4 values (1,$val1);
-eval insert into t4 values (2,$val2);
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t4;
-eval insert into t5 values (1,$val1);
-eval insert into t5 values (2,$val2);
-eval insert into t5 values (3,$val3);
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t5;
-eval insert into t6 values (1,$val2);
-eval insert into t6 values (2,$val3);
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t6;
-eval select $sqlfunc from t1;
+eval select $sqlfunc from t1 order by col1;
-select * from t1;
-select * from t2;
-select * from t3;
-select * from t4;
-select * from t5;
-select * from t6;
+select * from t1 order by col1;
+select * from t2 order by col1;
+select * from t3 order by col1;
+select * from t4 order by colint;
+select * from t5 order by colint;
+select * from t6 order by colint;
if ($do_long_tests)
{
@@ -111,12 +110,12 @@ if ($do_long_tests)
eval update t5 set col1=$val4 where col1=$val1;
eval update t6 set col1=$val4 where col1=$val1;
- select * from t1;
- select * from t2;
- select * from t3;
- select * from t4;
- select * from t5;
- select * from t6;
+ select * from t1 order by col1;
+ select * from t2 order by col1;
+ select * from t3 order by col1;
+ select * from t4 order by colint;
+ select * from t5 order by colint;
+ select * from t6 order by colint;
}
--echo -------------------------------------------------------------------------
@@ -175,46 +174,63 @@ partition by range(colint)
(partition p0 values less than ($valsqlfunc),
partition p1 values less than maxvalue);
-select * from t11;
-select * from t22;
-select * from t33;
-select * from t44;
-select * from t55;
-select * from t66;
+select * from t11 order by col1;
+select * from t22 order by col1;
+select * from t33 order by col1;
+select * from t44 order by colint;
+select * from t55 order by colint;
+select * from t66 order by colint;
if ($do_long_tests)
{
+ --echo ---------------------------
+ --echo ---- some alter table begin
+ --echo ---------------------------
eval alter table t11
reorganize partition p0,p1 into
(partition s1 values less than maxvalue);
- select * from t11;
+ select * from t11 order by col1;
eval alter table t11
reorganize partition s1 into
(partition p0 values less than (15),
partition p1 values less than maxvalue);
- select * from t11;
+ select * from t11 order by col1;
+
+eval alter table t55
+partition by list(colint)
+subpartition by hash($sqlfunc) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+ partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+ partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+ partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+ partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+ partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+ show create table t55;
+ select * from t55 order by colint;
eval alter table t66
reorganize partition p0,p1 into
(partition s1 values less than maxvalue);
- select * from t66;
+ select * from t66 order by colint;
eval alter table t66
reorganize partition s1 into
(partition p0 values less than ($valsqlfunc),
partition p1 values less than maxvalue);
- select * from t66;
+ select * from t66 order by colint;
eval alter table t66
reorganize partition p0,p1 into
(partition s1 values less than maxvalue);
- select * from t66;
+ select * from t66 order by colint;
- eval alter table t66
- add partition s0
- (partition p0 values less than ($valsqlfunc);
- select * fromt t66;
+ eval alter table t66
+ reorganize partition s1 into
+ (partition p0 values less than ($valsqlfunc),
+ partition p1 values less than maxvalue);
+ select * from t66 order by colint;
let $t1=t1;
let $t2=t2;
@@ -233,6 +249,9 @@ if ($do_long_tests)
let $t6=t66;
--source suite/partitions/include/partition_supported_sql_funcs_delete.inc
# --source include/partition_supported_sql_funcs_delete.inc
+ --echo -------------------------
+ --echo ---- some alter table end
+ --echo -------------------------
}
--disable_warnings
drop table if exists t1 ;
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc
index c733d750fab..76e8bd6dcc6 100644
--- a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc
@@ -1,3 +1,16 @@
+################################################################################
+# t/partition_supported_sql_funcs_delete.inc # # #
+# Purpose: #
+# Delete access of the tests frame for allowed sql functions #
+# #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-11-22 #
+# Change Author: #
+# Change Date: #
+# Change: #
+################################################################################
--echo -------------------------------------------------------------------------
--echo --- Delete rows and partitions of tables with $sqlfunc
--echo -------------------------------------------------------------------------
@@ -9,25 +22,25 @@ eval delete from $t4 where col1=$val2;
eval delete from $t5 where col1=$val2;
eval delete from $t6 where col1=$val2;
-eval select * from $t1;
-eval select * from $t2;
-eval select * from $t3;
-eval select * from $t4;
-eval select * from $t5;
+eval select * from $t1 order by col1;
+eval select * from $t2 order by col1;
+eval select * from $t3 order by col1;
+eval select * from $t4 order by colint;
+eval select * from $t5 order by colint;
eval insert into $t1 values ($val2);
eval insert into $t2 values ($val2);
eval insert into $t3 values ($val2);
-eval insert into $t4 values (4,$val2);
-eval insert into $t5 values (4,$val2);
-eval insert into $t6 values (4,$val2);
+eval insert into $t4 values (60,$val2);
+eval insert into $t5 values (60,$val2);
+eval insert into $t6 values (60,$val2);
-eval select * from $t1;
-eval select * from $t2;
-eval select * from $t3;
-eval select * from $t4;
-eval select * from $t5;
-eval select * from $t6;
+eval select * from $t1 order by col1;
+eval select * from $t2 order by col1;
+eval select * from $t3 order by col1;
+eval select * from $t4 order by colint;
+eval select * from $t5 order by colint;
+eval select * from $t6 order by colint;
eval alter table $t1 drop partition p0;
eval alter table $t2 drop partition p0;
@@ -35,9 +48,9 @@ eval alter table $t4 drop partition p0;
eval alter table $t5 drop partition p0;
eval alter table $t6 drop partition p0;
-eval select * from $t1;
-eval select * from $t2;
-eval select * from $t3;
-eval select * from $t4;
-eval select * from $t5;
-eval select * from $t6;
+eval select * from $t1 order by col1;
+eval select * from $t2 order by col1;
+eval select * from $t3 order by col1;
+eval select * from $t4 order by colint;
+eval select * from $t5 order by colint;
+eval select * from $t6 order by colint;
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in
new file mode 100644
index 00000000000..8ae6e5fc807
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in
@@ -0,0 +1,4 @@
+1 1
+2 9
+3 3
+4 8 \ No newline at end of file
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in
new file mode 100644
index 00000000000..9eb41fb007b
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in
@@ -0,0 +1,4 @@
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05 \ No newline at end of file
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in
new file mode 100644
index 00000000000..34d8b1d1c4d
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in
@@ -0,0 +1,4 @@
+1 5.1230
+2 13.345
+3 17.987
+4 15.654
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in
new file mode 100644
index 00000000000..d2f5c82a241
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in
@@ -0,0 +1,45 @@
+1 5
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123 \ No newline at end of file
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in
new file mode 100644
index 00000000000..941ba418f32
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in
@@ -0,0 +1,4 @@
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc
index ccfdd7a2ece..b0ec63d39a9 100644
--- a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc
@@ -2,7 +2,7 @@
# t/partition_supported_sql_funcs_main.inc #
# #
# Purpose: #
-# Tests around sql functions #
+# Tests which SQL functions are allowed in partinioning clauses. #
# #
# #
#------------------------------------------------------------------------------#
@@ -11,12 +11,28 @@
# Change Author: #
# Change Date: #
# Change: #
+# #
+# This test uses a test frame (partition_supported_sql_funcs.inc) for every #
+# SQL function allowed in the partitioning parts of CREATE and ALTE TABLE. #
+# The variales represent the #
+# - SQL function isself with a column (sqlfunc) and a literal (valsqlsunc), #
+# - the type of the column (coltype), #
+# - a file with test values of the coltype (infile) and #
+# - single test values (val1 to val4). #
+# The test frame includes CREATE/ALTER TABLE and some access statements. #
+# Column types are int, float(7,4), char(1), date and time depending on the #
+# SQL function. The test frame uses the include file #
+# "partition_supported_sql_funcs_delete.inc" testing the deletion of #
+# partitions. #
+# The CREATE and ALTER TABLE statement do not cover the complete partitions #
+# functions, but will ashure that the SQL functions are basically working. #
################################################################################
let $sqlfunc = abs(col1);
let $valsqlfunc = abs(15);
let $coltype = int;
+let $infile = partition_supported_sql_funcs_int_int.in;
let $val1 = 5 ;
let $val2 = 13 ;
let $val3 = 17 ;
@@ -27,6 +43,7 @@ let $val4 = 15 ;
let $sqlfunc = ascii(col1);
let $valsqlfunc = ascii('5');
let $coltype = char(1);
+let $infile = partition_supported_sql_funcs_int_ch1.in;
let $val1 = '1';
let $val2 = '9';
let $val3 = '3';
@@ -37,6 +54,7 @@ let $val4 = '8';
let $sqlfunc = cast(ceiling(col1) as signed integer);
let $valsqlfunc = cast(ceiling(15) as signed integer);
let $coltype = float(7,4);
+let $infile = partition_supported_sql_funcs_int_float.in;
let $val1 = 5.1230;
let $val2 = 13.345;
let $val3 = 17.987;
@@ -47,6 +65,7 @@ let $val4 = 15.654 ;
let $sqlfunc = cast(floor(col1) as signed);
let $valsqlfunc = cast(floor(15.123) as signed);
let $coltype = float(7,4);
+let $infile = partition_supported_sql_funcs_int_float.in;
let $val1 = 5.1230;
let $val2 = 13.345;
let $val3 = 17.987;
@@ -57,6 +76,7 @@ let $val4 = 15.654 ;
let $sqlfunc = cast(mod(col1,10) as signed);
let $valsqlfunc = cast(mod(15,10) as signed);
let $coltype = float(7,4);
+let $infile = partition_supported_sql_funcs_int_float.in;
let $val1 = 5.0000;
let $val2 = 19;
let $val3 = 17;
@@ -67,6 +87,7 @@ let $val4 = 15 ;
let $sqlfunc = ord(col1);
let $valsqlfunc = ord('a');
let $coltype = char(3);
+let $infile = partition_supported_sql_funcs_int_ch1.in;
let $val1 = '1';
let $val2 = '9';
let $val3 = '3';
@@ -77,6 +98,7 @@ let $val4 = '8';
let $sqlfunc = day(col1);
let $valsqlfunc = day('2006-12-21');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-02-03';
let $val2 = '2006-01-17';
let $val3 = '2006-01-25';
@@ -87,6 +109,7 @@ let $val4 = '2006-02-05';
let $sqlfunc = dayofmonth(col1);
let $valsqlfunc = dayofmonth('2006-12-24');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-02-03';
let $val2 = '2006-01-17';
let $val3 = '2006-01-25';
@@ -97,6 +120,7 @@ let $val4 = '2006-02-05';
let $sqlfunc = dayofweek(col1);
let $valsqlfunc = dayofweek('2006-12-24');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-01-03';
let $val2 = '2006-02-17';
let $val3 = '2006-01-25';
@@ -107,6 +131,7 @@ let $val4 = '2006-02-05';
let $sqlfunc = dayofyear(col1);
let $valsqlfunc = dayofyear('2006-12-25');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-01-03';
let $val2 = '2006-01-17';
let $val3 = '2006-02-25';
@@ -120,6 +145,7 @@ let $coltype = char(30);
let $sqlfunc = extract(month from col1);
let $valsqlfunc = extract(year from '1998-11-23');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-01-03';
let $val2 = '2006-02-17';
let $val3 = '2006-01-25';
@@ -130,6 +156,7 @@ let $val4 = '2006-02-05';
let $sqlfunc = hour(col1);
let $valsqlfunc = hour('18:30');
let $coltype = time;
+let $infile = partition_supported_sql_funcs_int_time.in;
let $val1 = '09:09';
let $val2 = '14:30';
let $val3 = '21:59';
@@ -140,6 +167,7 @@ let $val4 = '10:30';
let $sqlfunc = microsecond(col1);
let $valsqlfunc = microsecond('10:30:10.000010');
let $coltype = time;
+let $infile = partition_supported_sql_funcs_int_time.in;
let $val1 = '09:09:15.000002';
let $val2 = '04:30:01.000018';
let $val3 = '00:59:22.000024';
@@ -160,6 +188,7 @@ let $val4 = '10:24:23';
let $sqlfunc = second(col1);
let $valsqlfunc = second('18:30:14');
let $coltype = time;
+let $infile = partition_supported_sql_funcs_int_time.in;
let $val1 = '09:09:09';
let $val2 = '14:30:20';
let $val3 = '21:59:22';
@@ -173,6 +202,7 @@ let $coltype = char(30);
let $sqlfunc = month(col1);
let $valsqlfunc = month('2006-10-14');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-01-03';
let $val2 = '2006-12-17';
let $val3 = '2006-05-25';
@@ -183,6 +213,7 @@ let $val4 = '2006-11-06';
let $sqlfunc = quarter(col1);
let $valsqlfunc = quarter('2006-10-14');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-01-03';
let $val2 = '2006-12-17';
let $val3 = '2006-09-25';
@@ -193,6 +224,7 @@ let $val4 = '2006-07-30';
let $sqlfunc = time_to_sec(col1)-(time_to_sec(col1)-20);
let $valsqlfunc = time_to_sec('18:30:14')-(time_to_sec('17:59:59'));
let $coltype = time;
+let $infile = partition_supported_sql_funcs_int_time.in;
let $val1 = '09:09:15';
let $val2 = '14:30:45';
let $val3 = '21:59:22';
@@ -203,6 +235,7 @@ let $val4 = '10:33:11';
let $sqlfunc = to_days(col1)-to_days('2006-01-01');
let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-02-03';
let $val2 = '2006-01-17';
let $val3 = '2006-01-25';
@@ -213,6 +246,7 @@ let $val4 = '2006-02-06';
let $sqlfunc = weekday(col1);
let $valsqlfunc = weekday('2006-10-14');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-12-03';
let $val2 = '2006-11-17';
let $val3 = '2006-05-25';
@@ -223,6 +257,7 @@ let $val4 = '2006-02-06';
let $sqlfunc = weekofyear(col1);
let $valsqlfunc = weekofyear('2006-02-14');
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-01-03';
let $val2 = '2006-03-17';
let $val3 = '2006-05-25';
@@ -233,6 +268,7 @@ let $val4 = '2006-09-06';
let $sqlfunc = year(col1)-1990;
let $valsqlfunc = year('2005-10-14')-1990;
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '1996-01-03';
let $val2 = '2000-02-17';
let $val3 = '2004-05-25';
@@ -243,6 +279,7 @@ let $val4 = '2002-02-15';
let $sqlfunc = yearweek(col1)-200600;
let $valsqlfunc = yearweek('2006-10-14')-200600;
let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
let $val1 = '2006-01-03';
let $val2 = '2006-08-17';
let $val3 = '2006-03-25';
diff --git a/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result b/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result
index bb25ac5fc73..196f7930bb0 100644
--- a/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result
+++ b/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result
@@ -55,44 +55,329 @@ insert into t2 values (17 );
insert into t3 values (5 );
insert into t3 values (13 );
insert into t3 values (17 );
-insert into t4 values (1,5 );
-insert into t4 values (2,13 );
-insert into t5 values (1,5 );
-insert into t5 values (2,13 );
-insert into t5 values (3,17 );
-insert into t6 values (1,13 );
-insert into t6 values (2,17 );
-select abs(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t6;
+select abs(col1) from t1 order by col1;
abs(col1)
5
13
-select * from t1;
+select * from t1 order by col1;
col1
5
13
-select * from t2;
+select * from t2 order by col1;
col1
5
13
17
-select * from t3;
+select * from t3 order by col1;
col1
5
13
17
-select * from t4;
+select * from t4 order by colint;
colint col1
1 5
2 13
-select * from t5;
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t5 order by colint;
colint col1
1 5
2 13
-3 17
-select * from t6;
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t6 order by colint;
colint col1
-1 13
-2 17
+1 5
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+update t1 set col1=15 where col1=5 ;
+update t2 set col1=15 where col1=5 ;
+update t3 set col1=15 where col1=5 ;
+update t4 set col1=15 where col1=5 ;
+update t5 set col1=15 where col1=5 ;
+update t6 set col1=15 where col1=5 ;
+select * from t1 order by col1;
+col1
+13
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t5 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t6 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
-------------------------------------------------------------------------
--- Alter tables with abs(col1)
-------------------------------------------------------------------------
@@ -142,33 +427,1241 @@ alter table t66
partition by range(colint)
(partition p0 values less than (abs(15)),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-5
13
-select * from t22;
+15
+select * from t22 order by col1;
col1
-5
13
+15
17
-select * from t33;
+select * from t33 order by col1;
col1
-5
13
+15
17
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 5
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t55 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t66 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13
+15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13
+15
+alter table t55
+partition by list(colint)
+subpartition by hash(abs(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15
2 13
-select * from t55;
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 5
+1 15
2 13
-3 17
-select * from t66;
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 13
-2 17
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with abs(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1=13 ;
+delete from t2 where col1=13 ;
+delete from t3 where col1=13 ;
+delete from t4 where col1=13 ;
+delete from t5 where col1=13 ;
+delete from t6 where col1=13 ;
+select * from t1 order by col1;
+col1
+15
+select * from t2 order by col1;
+col1
+15
+17
+select * from t3 order by col1;
+col1
+15
+17
+select * from t4 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t5 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+insert into t1 values (13 );
+insert into t2 values (13 );
+insert into t3 values (13 );
+insert into t4 values (60,13 );
+insert into t5 values (60,13 );
+insert into t6 values (60,13 );
+select * from t1 order by col1;
+col1
+13
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t5 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t6 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t5 order by colint;
+colint col1
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t6 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with abs(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1=13 ;
+delete from t22 where col1=13 ;
+delete from t33 where col1=13 ;
+delete from t44 where col1=13 ;
+delete from t55 where col1=13 ;
+delete from t66 where col1=13 ;
+select * from t11 order by col1;
+col1
+15
+select * from t22 order by col1;
+col1
+15
+17
+select * from t33 order by col1;
+col1
+15
+17
+select * from t44 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t55 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+insert into t11 values (13 );
+insert into t22 values (13 );
+insert into t33 values (13 );
+insert into t44 values (60,13 );
+insert into t55 values (60,13 );
+insert into t66 values (60,13 );
+select * from t11 order by col1;
+col1
+13
+15
+select * from t22 order by col1;
+col1
+13
+15
+17
+select * from t33 order by col1;
+col1
+13
+15
+17
+select * from t44 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t55 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t66 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15
+select * from t22 order by col1;
+col1
+13
+15
+17
+select * from t33 order by col1;
+col1
+13
+15
+17
+select * from t44 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t55 order by colint;
+colint col1
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t66 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -238,44 +1731,83 @@ insert into t2 values ('3');
insert into t3 values ('1');
insert into t3 values ('9');
insert into t3 values ('3');
-insert into t4 values (1,'1');
-insert into t4 values (2,'9');
-insert into t5 values (1,'1');
-insert into t5 values (2,'9');
-insert into t5 values (3,'3');
-insert into t6 values (1,'9');
-insert into t6 values (2,'3');
-select ascii(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
+select ascii(col1) from t1 order by col1;
ascii(col1)
49
57
-select * from t1;
+select * from t1 order by col1;
col1
1
9
-select * from t2;
+select * from t2 order by col1;
col1
1
-9
3
-select * from t3;
+9
+select * from t3 order by col1;
col1
1
-9
3
-select * from t4;
+9
+select * from t4 order by colint;
colint col1
1 1
2 9
-select * from t5;
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t6 order by colint;
colint col1
1 1
2 9
3 3
-select * from t6;
+4 8
+update t1 set col1='8' where col1='1';
+update t2 set col1='8' where col1='1';
+update t3 set col1='8' where col1='1';
+update t4 set col1='8' where col1='1';
+update t5 set col1='8' where col1='1';
+update t6 set col1='8' where col1='1';
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t5 order by colint;
colint col1
-1 9
-2 3
+1 8
+2 9
+3 3
+4 8
+select * from t6 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
-------------------------------------------------------------------------
--- Alter tables with ascii(col1)
-------------------------------------------------------------------------
@@ -325,33 +1857,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (ascii('5')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-1
+8
9
-select * from t22;
+select * from t22 order by col1;
col1
-1
+3
+8
9
+select * from t33 order by col1;
+col1
3
-select * from t33;
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-1
+8
9
-3
-select * from t44;
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t55
+partition by list(colint)
+subpartition by hash(ascii(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ascii(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 1
+1 8
2 9
-select * from t55;
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
2 9
3 3
-select * from t66;
+4 8
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ascii(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='9';
+delete from t2 where col1='9';
+delete from t3 where col1='9';
+delete from t4 where col1='9';
+delete from t5 where col1='9';
+delete from t6 where col1='9';
+select * from t1 order by col1;
+col1
+8
+select * from t2 order by col1;
+col1
+3
+8
+select * from t3 order by col1;
+col1
+3
+8
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t1 values ('9');
+insert into t2 values ('9');
+insert into t3 values ('9');
+insert into t4 values (60,'9');
+insert into t5 values (60,'9');
+insert into t6 values (60,'9');
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
colint col1
-1 9
-2 3
+1 8
+3 3
+4 8
+60 9
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t6 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+60 9
+select * from t5 order by colint;
+colint col1
+60 9
+select * from t6 order by colint;
+colint col1
+60 9
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ascii(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='9';
+delete from t22 where col1='9';
+delete from t33 where col1='9';
+delete from t44 where col1='9';
+delete from t55 where col1='9';
+delete from t66 where col1='9';
+select * from t11 order by col1;
+col1
+8
+select * from t22 order by col1;
+col1
+3
+8
+select * from t33 order by col1;
+col1
+3
+8
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t11 values ('9');
+insert into t22 values ('9');
+insert into t33 values ('9');
+insert into t44 values (60,'9');
+insert into t55 values (60,'9');
+insert into t66 values (60,'9');
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t66 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+60 9
+select * from t55 order by colint;
+colint col1
+60 9
+select * from t66 order by colint;
+colint col1
+60 9
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -421,44 +2231,83 @@ insert into t2 values (17.987);
insert into t3 values (5.1230);
insert into t3 values (13.345);
insert into t3 values (17.987);
-insert into t4 values (1,5.1230);
-insert into t4 values (2,13.345);
-insert into t5 values (1,5.1230);
-insert into t5 values (2,13.345);
-insert into t5 values (3,17.987);
-insert into t6 values (1,13.345);
-insert into t6 values (2,17.987);
-select cast(ceiling(col1) as signed integer) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(ceiling(col1) as signed integer) from t1 order by col1;
cast(ceiling(col1) as signed integer)
6
14
-select * from t1;
+select * from t1 order by col1;
col1
5.1230
13.3450
-select * from t2;
+select * from t2 order by col1;
col1
5.1230
13.3450
17.9870
-select * from t3;
+select * from t3 order by col1;
col1
5.1230
13.3450
17.9870
-select * from t4;
+select * from t4 order by colint;
colint col1
1 5.1230
2 13.3450
-select * from t5;
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
1 5.1230
2 13.3450
3 17.9870
-select * from t6;
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+update t1 set col1=15.654 where col1=5.1230;
+update t2 set col1=15.654 where col1=5.1230;
+update t3 set col1=15.654 where col1=5.1230;
+update t4 set col1=15.654 where col1=5.1230;
+update t5 set col1=15.654 where col1=5.1230;
+update t6 set col1=15.654 where col1=5.1230;
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(ceiling(col1) as signed integer)
-------------------------------------------------------------------------
@@ -508,33 +2357,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (cast(ceiling(15) as signed integer)),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-5.1230
13.3450
-select * from t22;
+15.6540
+select * from t22 order by col1;
col1
-5.1230
13.3450
+15.6540
17.9870
-select * from t33;
+select * from t33 order by col1;
col1
-5.1230
13.3450
+15.6540
17.9870
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 5.1230
+1 15.6540
2 13.3450
-select * from t55;
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
colint col1
-1 5.1230
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` float(7,4) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(ceiling(col1) as signed integer)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
2 13.3450
3 17.9870
-select * from t66;
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+delete from t1 where col1=13.345;
+delete from t2 where col1=13.345;
+delete from t3 where col1=13.345;
+delete from t4 where col1=13.345;
+delete from t5 where col1=13.345;
+delete from t6 where col1=13.345;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t1 values (13.345);
+insert into t2 values (13.345);
+insert into t3 values (13.345);
+insert into t4 values (60,13.345);
+insert into t5 values (60,13.345);
+insert into t6 values (60,13.345);
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t6 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+60 13.3450
+select * from t5 order by colint;
+colint col1
+60 13.3450
+select * from t6 order by colint;
+colint col1
+60 13.3450
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+delete from t11 where col1=13.345;
+delete from t22 where col1=13.345;
+delete from t33 where col1=13.345;
+delete from t44 where col1=13.345;
+delete from t55 where col1=13.345;
+delete from t66 where col1=13.345;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t11 values (13.345);
+insert into t22 values (13.345);
+insert into t33 values (13.345);
+insert into t44 values (60,13.345);
+insert into t55 values (60,13.345);
+insert into t66 values (60,13.345);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t66 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+60 13.3450
+select * from t55 order by colint;
+colint col1
+60 13.3450
+select * from t66 order by colint;
+colint col1
+60 13.3450
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -604,44 +2729,83 @@ insert into t2 values (17.987);
insert into t3 values (5.1230);
insert into t3 values (13.345);
insert into t3 values (17.987);
-insert into t4 values (1,5.1230);
-insert into t4 values (2,13.345);
-insert into t5 values (1,5.1230);
-insert into t5 values (2,13.345);
-insert into t5 values (3,17.987);
-insert into t6 values (1,13.345);
-insert into t6 values (2,17.987);
-select cast(floor(col1) as signed) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(floor(col1) as signed) from t1 order by col1;
cast(floor(col1) as signed)
5
13
-select * from t1;
+select * from t1 order by col1;
col1
5.1230
13.3450
-select * from t2;
+select * from t2 order by col1;
col1
5.1230
13.3450
17.9870
-select * from t3;
+select * from t3 order by col1;
col1
5.1230
13.3450
17.9870
-select * from t4;
+select * from t4 order by colint;
colint col1
1 5.1230
2 13.3450
-select * from t5;
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
1 5.1230
2 13.3450
3 17.9870
-select * from t6;
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+update t1 set col1=15.654 where col1=5.1230;
+update t2 set col1=15.654 where col1=5.1230;
+update t3 set col1=15.654 where col1=5.1230;
+update t4 set col1=15.654 where col1=5.1230;
+update t5 set col1=15.654 where col1=5.1230;
+update t6 set col1=15.654 where col1=5.1230;
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(floor(col1) as signed)
-------------------------------------------------------------------------
@@ -691,33 +2855,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (cast(floor(15.123) as signed)),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-5.1230
13.3450
-select * from t22;
+15.6540
+select * from t22 order by col1;
col1
-5.1230
13.3450
+15.6540
17.9870
-select * from t33;
+select * from t33 order by col1;
col1
-5.1230
13.3450
+15.6540
17.9870
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 5.1230
+1 15.6540
2 13.3450
-select * from t55;
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
colint col1
-1 5.1230
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` float(7,4) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(floor(col1) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
2 13.3450
3 17.9870
-select * from t66;
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+delete from t1 where col1=13.345;
+delete from t2 where col1=13.345;
+delete from t3 where col1=13.345;
+delete from t4 where col1=13.345;
+delete from t5 where col1=13.345;
+delete from t6 where col1=13.345;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t1 values (13.345);
+insert into t2 values (13.345);
+insert into t3 values (13.345);
+insert into t4 values (60,13.345);
+insert into t5 values (60,13.345);
+insert into t6 values (60,13.345);
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t6 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+60 13.3450
+select * from t5 order by colint;
+colint col1
+60 13.3450
+select * from t6 order by colint;
+colint col1
+60 13.3450
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+delete from t11 where col1=13.345;
+delete from t22 where col1=13.345;
+delete from t33 where col1=13.345;
+delete from t44 where col1=13.345;
+delete from t55 where col1=13.345;
+delete from t66 where col1=13.345;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t11 values (13.345);
+insert into t22 values (13.345);
+insert into t33 values (13.345);
+insert into t44 values (60,13.345);
+insert into t55 values (60,13.345);
+insert into t66 values (60,13.345);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t66 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+60 13.3450
+select * from t55 order by colint;
+colint col1
+60 13.3450
+select * from t66 order by colint;
+colint col1
+60 13.3450
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -787,44 +3227,83 @@ insert into t2 values (17);
insert into t3 values (5.0000);
insert into t3 values (19);
insert into t3 values (17);
-insert into t4 values (1,5.0000);
-insert into t4 values (2,19);
-insert into t5 values (1,5.0000);
-insert into t5 values (2,19);
-insert into t5 values (3,17);
-insert into t6 values (1,19);
-insert into t6 values (2,17);
-select cast(mod(col1,10) as signed) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(mod(col1,10) as signed) from t1 order by col1;
cast(mod(col1,10) as signed)
5
9
-select * from t1;
+select * from t1 order by col1;
col1
5.0000
19.0000
-select * from t2;
+select * from t2 order by col1;
col1
5.0000
-19.0000
17.0000
-select * from t3;
+19.0000
+select * from t3 order by col1;
col1
5.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+update t1 set col1=15 where col1=5.0000;
+update t2 set col1=15 where col1=5.0000;
+update t3 set col1=15 where col1=5.0000;
+update t4 set col1=15 where col1=5.0000;
+update t5 set col1=15 where col1=5.0000;
+update t6 set col1=15 where col1=5.0000;
+select * from t1 order by col1;
+col1
+15.0000
+19.0000
+select * from t2 order by col1;
+col1
+15.0000
+17.0000
19.0000
+select * from t3 order by col1;
+col1
+15.0000
17.0000
-select * from t4;
+19.0000
+select * from t4 order by colint;
colint col1
-1 5.0000
-2 19.0000
-select * from t5;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
-1 5.0000
-2 19.0000
-3 17.0000
-select * from t6;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 19.0000
-2 17.0000
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(mod(col1,10) as signed)
-------------------------------------------------------------------------
@@ -874,33 +3353,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (cast(mod(15,10) as signed)),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-5.0000
+15.0000
19.0000
-select * from t22;
+select * from t22 order by col1;
col1
-5.0000
+15.0000
+17.0000
19.0000
+select * from t33 order by col1;
+col1
+15.0000
17.0000
-select * from t33;
+19.0000
+select * from t44 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-5.0000
+15.0000
19.0000
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` float(7,4) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(mod(col1,10) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+delete from t1 where col1=19;
+delete from t2 where col1=19;
+delete from t3 where col1=19;
+delete from t4 where col1=19;
+delete from t5 where col1=19;
+delete from t6 where col1=19;
+select * from t1 order by col1;
+col1
+15.0000
+select * from t2 order by col1;
+col1
+15.0000
17.0000
-select * from t44;
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+select * from t4 order by colint;
colint col1
-1 5.0000
-2 19.0000
-select * from t55;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
-1 5.0000
-2 19.0000
-3 17.0000
-select * from t66;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+insert into t1 values (19);
+insert into t2 values (19);
+insert into t3 values (19);
+insert into t4 values (60,19);
+insert into t5 values (60,19);
+insert into t6 values (60,19);
+select * from t1 order by col1;
+col1
+15.0000
+19.0000
+select * from t2 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t6 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+60 19.0000
+select * from t5 order by colint;
+colint col1
+60 19.0000
+select * from t6 order by colint;
+colint col1
+60 19.0000
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+delete from t11 where col1=19;
+delete from t22 where col1=19;
+delete from t33 where col1=19;
+delete from t44 where col1=19;
+delete from t55 where col1=19;
+delete from t66 where col1=19;
+select * from t11 order by col1;
+col1
+15.0000
+select * from t22 order by col1;
+col1
+15.0000
+17.0000
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+select * from t44 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+insert into t11 values (19);
+insert into t22 values (19);
+insert into t33 values (19);
+insert into t44 values (60,19);
+insert into t55 values (60,19);
+insert into t66 values (60,19);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+select * from t22 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t44 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t44 order by colint;
+colint col1
+60 19.0000
+select * from t55 order by colint;
+colint col1
+60 19.0000
+select * from t66 order by colint;
colint col1
-1 19.0000
-2 17.0000
+60 19.0000
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -970,44 +3727,83 @@ insert into t2 values ('3');
insert into t3 values ('1');
insert into t3 values ('9');
insert into t3 values ('3');
-insert into t4 values (1,'1');
-insert into t4 values (2,'9');
-insert into t5 values (1,'1');
-insert into t5 values (2,'9');
-insert into t5 values (3,'3');
-insert into t6 values (1,'9');
-insert into t6 values (2,'3');
-select ord(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
+select ord(col1) from t1 order by col1;
ord(col1)
49
57
-select * from t1;
+select * from t1 order by col1;
col1
1
9
-select * from t2;
+select * from t2 order by col1;
col1
1
-9
3
-select * from t3;
+9
+select * from t3 order by col1;
col1
1
-9
3
-select * from t4;
+9
+select * from t4 order by colint;
colint col1
1 1
2 9
-select * from t5;
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t6 order by colint;
colint col1
1 1
2 9
3 3
-select * from t6;
+4 8
+update t1 set col1='8' where col1='1';
+update t2 set col1='8' where col1='1';
+update t3 set col1='8' where col1='1';
+update t4 set col1='8' where col1='1';
+update t5 set col1='8' where col1='1';
+update t6 set col1='8' where col1='1';
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t5 order by colint;
colint col1
-1 9
-2 3
+1 8
+2 9
+3 3
+4 8
+select * from t6 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
-------------------------------------------------------------------------
--- Alter tables with ord(col1)
-------------------------------------------------------------------------
@@ -1057,33 +3853,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (ord('a')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-1
+8
9
-select * from t22;
+select * from t22 order by col1;
col1
-1
+3
+8
9
+select * from t33 order by col1;
+col1
3
-select * from t33;
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-1
+8
9
-3
-select * from t44;
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t55
+partition by list(colint)
+subpartition by hash(ord(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(3) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ord(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 1
+1 8
2 9
-select * from t55;
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 1
+1 8
2 9
3 3
-select * from t66;
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ord(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='9';
+delete from t2 where col1='9';
+delete from t3 where col1='9';
+delete from t4 where col1='9';
+delete from t5 where col1='9';
+delete from t6 where col1='9';
+select * from t1 order by col1;
+col1
+8
+select * from t2 order by col1;
+col1
+3
+8
+select * from t3 order by col1;
+col1
+3
+8
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t1 values ('9');
+insert into t2 values ('9');
+insert into t3 values ('9');
+insert into t4 values (60,'9');
+insert into t5 values (60,'9');
+insert into t6 values (60,'9');
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t6 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+60 9
+select * from t5 order by colint;
+colint col1
+60 9
+select * from t6 order by colint;
colint col1
-1 9
-2 3
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ord(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='9';
+delete from t22 where col1='9';
+delete from t33 where col1='9';
+delete from t44 where col1='9';
+delete from t55 where col1='9';
+delete from t66 where col1='9';
+select * from t11 order by col1;
+col1
+8
+select * from t22 order by col1;
+col1
+3
+8
+select * from t33 order by col1;
+col1
+3
+8
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t11 values ('9');
+insert into t22 values ('9');
+insert into t33 values ('9');
+insert into t44 values (60,'9');
+insert into t55 values (60,'9');
+insert into t66 values (60,'9');
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t66 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+60 9
+select * from t55 order by colint;
+colint col1
+60 9
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1153,44 +4225,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-02-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-02-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-01-25');
-select day(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select day(col1) from t1 order by col1;
day(col1)
-3
17
-select * from t1;
+3
+select * from t1 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t2;
-col1
2006-02-03
+select * from t2 order by col1;
+col1
2006-01-17
2006-01-25
-select * from t3;
-col1
2006-02-03
+select * from t3 order by col1;
+col1
2006-01-17
2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
-select * from t5;
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
3 2006-01-25
-select * from t6;
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-02-03';
+update t2 set col1='2006-02-05' where col1='2006-02-03';
+update t3 set col1='2006-02-05' where col1='2006-02-03';
+update t4 set col1='2006-02-05' where col1='2006-02-03';
+update t5 set col1='2006-02-05' where col1='2006-02-03';
+update t6 set col1='2006-02-05' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with day(col1)
-------------------------------------------------------------------------
@@ -1240,33 +4351,307 @@ alter table t66
partition by range(colint)
(partition p0 values less than (day('2006-12-21')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t33;
+2006-02-05
+select * from t33 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t44;
+2006-02-05
+select * from t44 order by colint;
colint col1
-1 2006-02-03
+1 2006-02-05
2 2006-01-17
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-1 2006-02-03
+1 2006-02-05
2 2006-01-17
3 2006-01-25
-select * from t66;
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(day(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with day(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+60 2006-01-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with day(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+60 2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1336,44 +4721,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-02-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-02-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-01-25');
-select dayofmonth(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofmonth(col1) from t1 order by col1;
dayofmonth(col1)
-3
17
-select * from t1;
+3
+select * from t1 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t2;
-col1
2006-02-03
+select * from t2 order by col1;
+col1
2006-01-17
2006-01-25
-select * from t3;
-col1
2006-02-03
+select * from t3 order by col1;
+col1
2006-01-17
2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
-select * from t5;
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
3 2006-01-25
-select * from t6;
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-02-03';
+update t2 set col1='2006-02-05' where col1='2006-02-03';
+update t3 set col1='2006-02-05' where col1='2006-02-03';
+update t4 set col1='2006-02-05' where col1='2006-02-03';
+update t5 set col1='2006-02-05' where col1='2006-02-03';
+update t6 set col1='2006-02-05' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with dayofmonth(col1)
-------------------------------------------------------------------------
@@ -1423,33 +4847,307 @@ alter table t66
partition by range(colint)
(partition p0 values less than (dayofmonth('2006-12-24')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t33;
+2006-02-05
+select * from t33 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t44;
+2006-02-05
+select * from t44 order by colint;
colint col1
-1 2006-02-03
+1 2006-02-05
2 2006-01-17
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-1 2006-02-03
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
2 2006-01-17
3 2006-01-25
-select * from t66;
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+60 2006-01-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+60 2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1519,44 +5217,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-02-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-02-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-02-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-02-17');
-insert into t6 values (2,'2006-01-25');
-select dayofweek(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofweek(col1) from t1 order by col1;
dayofweek(col1)
3
6
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-02-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
-2006-02-17
2006-01-25
-select * from t3;
+2006-02-17
+select * from t3 order by col1;
col1
2006-01-03
+2006-01-25
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-02-05
2006-02-17
+select * from t2 order by col1;
+col1
2006-01-25
-select * from t4;
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-2 2006-02-17
+1 2006-02-03
+2 2006-01-17
3 2006-01-25
-1 2006-01-03
-select * from t6;
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-02-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with dayofweek(col1)
-------------------------------------------------------------------------
@@ -1606,33 +5343,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (dayofweek('2006-12-24')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
+2006-02-05
2006-02-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-01-03
+2006-01-25
+2006-02-05
2006-02-17
+select * from t33 order by col1;
+col1
2006-01-25
-select * from t33;
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-01-03
+2006-02-05
2006-02-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofweek(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-02-17';
+delete from t2 where col1='2006-02-17';
+delete from t3 where col1='2006-02-17';
+delete from t4 where col1='2006-02-17';
+delete from t5 where col1='2006-02-17';
+delete from t6 where col1='2006-02-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-02-17');
+insert into t3 values ('2006-02-17');
+insert into t4 values (60,'2006-02-17');
+insert into t5 values (60,'2006-02-17');
+insert into t6 values (60,'2006-02-17');
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
2006-01-25
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t55;
+60 2006-02-17
+select * from t5 order by colint;
colint col1
-2 2006-02-17
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
3 2006-01-25
-1 2006-01-03
-select * from t66;
+4 2006-02-05
+60 2006-02-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofweek(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-02-17';
+delete from t22 where col1='2006-02-17';
+delete from t33 where col1='2006-02-17';
+delete from t44 where col1='2006-02-17';
+delete from t55 where col1='2006-02-17';
+delete from t66 where col1='2006-02-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-1 2006-02-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-02-17');
+insert into t22 values ('2006-02-17');
+insert into t33 values ('2006-02-17');
+insert into t44 values (60,'2006-02-17');
+insert into t55 values (60,'2006-02-17');
+insert into t66 values (60,'2006-02-17');
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1702,44 +5725,83 @@ insert into t2 values ('2006-02-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-02-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-02-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-02-25');
-select dayofyear(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofyear(col1) from t1 order by col1;
dayofyear(col1)
3
17
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-01-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-01-17
2006-02-25
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
2006-01-17
2006-02-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t5;
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-3 2006-02-25
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t6;
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-02-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with dayofyear(col1)
-------------------------------------------------------------------------
@@ -1789,33 +5851,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (dayofyear('2006-12-25')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
col1
-2006-01-03
2006-01-17
+2006-02-05
2006-02-25
-select * from t33;
+select * from t33 order by col1;
col1
-2006-01-03
2006-01-17
+2006-02-05
2006-02-25
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-3 2006-02-25
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t66;
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-01-17
-2 2006-02-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1885,44 +6223,83 @@ insert into t2 values ('2006-02-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-02-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-02-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-02-25');
-select dayofyear(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofyear(col1) from t1 order by col1;
dayofyear(col1)
3
17
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-01-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-01-17
2006-02-25
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
2006-01-17
2006-02-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 2006-01-03
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
2 2006-01-17
-select * from t5;
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-3 2006-02-25
-1 2006-01-03
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
2 2006-01-17
-select * from t6;
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-02-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with dayofyear(col1)
-------------------------------------------------------------------------
@@ -1972,33 +6349,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (dayofyear('2006-12-25')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
col1
-2006-01-03
2006-01-17
+2006-02-05
2006-02-25
-select * from t33;
+select * from t33 order by col1;
col1
-2006-01-03
2006-01-17
+2006-02-05
2006-02-25
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-3 2006-02-25
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t66;
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-01-17
-2 2006-02-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(30) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2068,44 +6721,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-02-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-02-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-02-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-02-17');
-insert into t6 values (2,'2006-01-25');
-select extract(month from col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select extract(month from col1) from t1 order by col1;
extract(month from col1)
1
2
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-02-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
-2006-02-17
2006-01-25
-select * from t3;
+2006-02-17
+select * from t3 order by col1;
col1
2006-01-03
+2006-01-25
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
2006-02-17
+select * from t3 order by col1;
+col1
2006-01-25
-select * from t4;
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
+1 2006-02-03
+2 2006-01-17
3 2006-01-25
-select * from t6;
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-02-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with extract(month from col1)
-------------------------------------------------------------------------
@@ -2155,33 +6847,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (extract(year from '1998-11-23')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
+2006-02-05
2006-02-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-01-03
+2006-01-25
+2006-02-05
2006-02-17
+select * from t33 order by col1;
+col1
2006-01-25
-select * from t33;
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-01-03
+2006-02-05
+2006-02-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+alter table t55
+partition by list(colint)
+subpartition by hash(extract(month from col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with extract(month from col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-02-17';
+delete from t2 where col1='2006-02-17';
+delete from t3 where col1='2006-02-17';
+delete from t4 where col1='2006-02-17';
+delete from t5 where col1='2006-02-17';
+delete from t6 where col1='2006-02-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-02-17');
+insert into t3 values ('2006-02-17');
+insert into t4 values (60,'2006-02-17');
+insert into t5 values (60,'2006-02-17');
+insert into t6 values (60,'2006-02-17');
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
2006-02-17
+select * from t3 order by col1;
+col1
2006-01-25
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t5 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
+1 2006-02-03
+2 2006-01-17
3 2006-01-25
-select * from t66;
+4 2006-02-05
+60 2006-02-17
+select * from t6 order by colint;
colint col1
-1 2006-02-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+60 2006-02-17
+select * from t5 order by colint;
+colint col1
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with extract(month from col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-02-17';
+delete from t22 where col1='2006-02-17';
+delete from t33 where col1='2006-02-17';
+delete from t44 where col1='2006-02-17';
+delete from t55 where col1='2006-02-17';
+delete from t66 where col1='2006-02-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-02-17');
+insert into t22 values ('2006-02-17');
+insert into t33 values ('2006-02-17');
+insert into t44 values (60,'2006-02-17');
+insert into t55 values (60,'2006-02-17');
+insert into t66 values (60,'2006-02-17');
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2251,44 +7219,83 @@ insert into t2 values ('21:59');
insert into t3 values ('09:09');
insert into t3 values ('14:30');
insert into t3 values ('21:59');
-insert into t4 values (1,'09:09');
-insert into t4 values (2,'14:30');
-insert into t5 values (1,'09:09');
-insert into t5 values (2,'14:30');
-insert into t5 values (3,'21:59');
-insert into t6 values (1,'14:30');
-insert into t6 values (2,'21:59');
-select hour(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select hour(col1) from t1 order by col1;
hour(col1)
9
14
-select * from t1;
+select * from t1 order by col1;
col1
09:09:00
14:30:00
-select * from t2;
+select * from t2 order by col1;
col1
09:09:00
14:30:00
21:59:00
-select * from t3;
+select * from t3 order by col1;
col1
09:09:00
14:30:00
21:59:00
-select * from t4;
+select * from t4 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-select * from t5;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-3 21:59:00
-select * from t6;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:30' where col1='09:09';
+update t2 set col1='10:30' where col1='09:09';
+update t3 set col1='10:30' where col1='09:09';
+update t4 set col1='10:30' where col1='09:09';
+update t5 set col1='10:30' where col1='09:09';
+update t6 set col1='10:30' where col1='09:09';
+select * from t1 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
colint col1
-1 14:30:00
-2 21:59:00
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with hour(col1)
-------------------------------------------------------------------------
@@ -2338,33 +7345,315 @@ alter table t66
partition by range(colint)
(partition p0 values less than (hour('18:30')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:00
+10:30:00
14:30:00
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:00
+10:30:00
14:30:00
21:59:00
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:00
+10:30:00
+14:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+alter table t55
+partition by list(colint)
+subpartition by hash(hour(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with hour(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30';
+delete from t2 where col1='14:30';
+delete from t3 where col1='14:30';
+delete from t4 where col1='14:30';
+delete from t5 where col1='14:30';
+delete from t6 where col1='14:30';
+select * from t1 order by col1;
+col1
+10:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30');
+insert into t2 values ('14:30');
+insert into t3 values ('14:30');
+insert into t4 values (60,'14:30');
+insert into t5 values (60,'14:30');
+insert into t6 values (60,'14:30');
+select * from t1 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+60 14:30:00
+select * from t5 order by colint;
+colint col1
+60 14:30:00
+select * from t6 order by colint;
+colint col1
+60 14:30:00
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with hour(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30';
+delete from t22 where col1='14:30';
+delete from t33 where col1='14:30';
+delete from t44 where col1='14:30';
+delete from t55 where col1='14:30';
+delete from t66 where col1='14:30';
+select * from t11 order by col1;
+col1
+10:30:00
+select * from t22 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30');
+insert into t22 values ('14:30');
+insert into t33 values ('14:30');
+insert into t44 values (60,'14:30');
+insert into t55 values (60,'14:30');
+insert into t66 values (60,'14:30');
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t22 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+14:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
14:30:00
21:59:00
-select * from t44;
+select * from t44 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-select * from t55;
+60 14:30:00
+select * from t55 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-3 21:59:00
-select * from t66;
+60 14:30:00
+select * from t66 order by colint;
colint col1
-1 14:30:00
-2 21:59:00
+60 14:30:00
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2434,44 +7723,83 @@ insert into t2 values ('00:59:22.000024');
insert into t3 values ('09:09:15.000002');
insert into t3 values ('04:30:01.000018');
insert into t3 values ('00:59:22.000024');
-insert into t4 values (1,'09:09:15.000002');
-insert into t4 values (2,'04:30:01.000018');
-insert into t5 values (1,'09:09:15.000002');
-insert into t5 values (2,'04:30:01.000018');
-insert into t5 values (3,'00:59:22.000024');
-insert into t6 values (1,'04:30:01.000018');
-insert into t6 values (2,'00:59:22.000024');
-select microsecond(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select microsecond(col1) from t1 order by col1;
microsecond(col1)
0
0
-select * from t1;
+select * from t1 order by col1;
col1
+04:30:01
09:09:15
+select * from t2 order by col1;
+col1
+00:59:22
04:30:01
-select * from t2;
+09:09:15
+select * from t3 order by col1;
col1
+00:59:22
+04:30:01
09:09:15
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t2 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t3 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t4 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t5 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t6 set col1='05:30:34.000037' where col1='09:09:15.000002';
+select * from t1 order by col1;
+col1
04:30:01
-00:59:22
-select * from t3;
+05:30:34
+select * from t2 order by col1;
col1
-09:09:15
+00:59:22
04:30:01
+05:30:34
+select * from t3 order by col1;
+col1
00:59:22
-select * from t4;
+04:30:01
+05:30:34
+select * from t4 order by colint;
colint col1
-1 09:09:15
+1 05:30:34
2 04:30:01
-select * from t5;
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-1 09:09:15
+1 05:30:34
2 04:30:01
3 00:59:22
-select * from t6;
+4 05:30:34
+select * from t6 order by colint;
colint col1
-1 04:30:01
-2 00:59:22
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with microsecond(col1)
-------------------------------------------------------------------------
@@ -2521,33 +7849,301 @@ alter table t66
partition by range(colint)
(partition p0 values less than (microsecond('10:30:10.000010')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:15
04:30:01
-select * from t22;
+05:30:34
+select * from t22 order by col1;
col1
-09:09:15
+00:59:22
04:30:01
+05:30:34
+select * from t33 order by col1;
+col1
00:59:22
-select * from t33;
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-09:09:15
04:30:01
-00:59:22
-select * from t44;
+05:30:34
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+alter table t55
+partition by list(colint)
+subpartition by hash(microsecond(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 09:09:15
+1 05:30:34
2 04:30:01
-select * from t55;
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 09:09:15
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 05:30:34
2 04:30:01
3 00:59:22
-select * from t66;
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with microsecond(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='04:30:01.000018';
+delete from t2 where col1='04:30:01.000018';
+delete from t3 where col1='04:30:01.000018';
+delete from t4 where col1='04:30:01.000018';
+delete from t5 where col1='04:30:01.000018';
+delete from t6 where col1='04:30:01.000018';
+select * from t1 order by col1;
+col1
+05:30:34
+select * from t2 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t3 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t4 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-1 04:30:01
-2 00:59:22
+1 05:30:34
+3 00:59:22
+4 05:30:34
+insert into t1 values ('04:30:01.000018');
+insert into t2 values ('04:30:01.000018');
+insert into t3 values ('04:30:01.000018');
+insert into t4 values (60,'04:30:01.000018');
+insert into t5 values (60,'04:30:01.000018');
+insert into t6 values (60,'04:30:01.000018');
+select * from t1 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t2 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t4 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t5 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t6 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t4 order by colint;
+colint col1
+60 04:30:01
+select * from t5 order by colint;
+colint col1
+60 04:30:01
+select * from t6 order by colint;
+colint col1
+60 04:30:01
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with microsecond(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='04:30:01.000018';
+delete from t22 where col1='04:30:01.000018';
+delete from t33 where col1='04:30:01.000018';
+delete from t44 where col1='04:30:01.000018';
+delete from t55 where col1='04:30:01.000018';
+delete from t66 where col1='04:30:01.000018';
+select * from t11 order by col1;
+col1
+05:30:34
+select * from t22 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t33 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t44 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+insert into t11 values ('04:30:01.000018');
+insert into t22 values ('04:30:01.000018');
+insert into t33 values ('04:30:01.000018');
+insert into t44 values (60,'04:30:01.000018');
+insert into t55 values (60,'04:30:01.000018');
+insert into t66 values (60,'04:30:01.000018');
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t22 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t33 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint col1
+60 04:30:01
+select * from t55 order by colint;
+colint col1
+60 04:30:01
+select * from t66 order by colint;
+colint col1
+60 04:30:01
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2617,44 +8213,83 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:15');
insert into t3 values ('14:30:45');
insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:15');
-insert into t4 values (2,'14:30:45');
-insert into t5 values (1,'09:09:15');
-insert into t5 values (2,'14:30:45');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:45');
-insert into t6 values (2,'21:59:22');
-select minute(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select minute(col1) from t1 order by col1;
minute(col1)
9
30
-select * from t1;
+select * from t1 order by col1;
col1
09:09:15
14:30:45
-select * from t2;
+select * from t2 order by col1;
col1
09:09:15
14:30:45
21:59:22
-select * from t3;
+select * from t3 order by col1;
col1
09:09:15
14:30:45
21:59:22
-select * from t4;
+select * from t4 order by colint;
colint col1
-2 14:30:45
1 09:09:15
-select * from t5;
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-2 14:30:45
1 09:09:15
-3 21:59:22
-select * from t6;
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:24:23' where col1='09:09:15';
+update t2 set col1='10:24:23' where col1='09:09:15';
+update t3 set col1='10:24:23' where col1='09:09:15';
+update t4 set col1='10:24:23' where col1='09:09:15';
+update t5 set col1='10:24:23' where col1='09:09:15';
+update t6 set col1='10:24:23' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with minute(col1)
-------------------------------------------------------------------------
@@ -2704,33 +8339,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (minute('18:30')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:15
+10:24:23
14:30:45
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:15
+10:24:23
14:30:45
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:15
+10:24:23
14:30:45
21:59:22
-select * from t44;
+select * from t44 order by colint;
colint col1
-2 14:30:45
-1 09:09:15
-select * from t55;
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
colint col1
-2 14:30:45
-1 09:09:15
-3 21:59:22
-select * from t66;
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(minute(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with minute(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:45';
+delete from t2 where col1='14:30:45';
+delete from t3 where col1='14:30:45';
+delete from t4 where col1='14:30:45';
+delete from t5 where col1='14:30:45';
+delete from t6 where col1='14:30:45';
+select * from t1 order by col1;
+col1
+10:24:23
+select * from t2 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30:45');
+insert into t2 values ('14:30:45');
+insert into t3 values ('14:30:45');
+insert into t4 values (60,'14:30:45');
+insert into t5 values (60,'14:30:45');
+insert into t6 values (60,'14:30:45');
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+60 14:30:45
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with minute(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:45';
+delete from t22 where col1='14:30:45';
+delete from t33 where col1='14:30:45';
+delete from t44 where col1='14:30:45';
+delete from t55 where col1='14:30:45';
+delete from t66 where col1='14:30:45';
+select * from t11 order by col1;
+col1
+10:24:23
+select * from t22 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30:45');
+insert into t22 values ('14:30:45');
+insert into t33 values ('14:30:45');
+insert into t44 values (60,'14:30:45');
+insert into t55 values (60,'14:30:45');
+insert into t66 values (60,'14:30:45');
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t22 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t22 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+60 14:30:45
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2800,44 +8723,83 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:09');
insert into t3 values ('14:30:20');
insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:09');
-insert into t4 values (2,'14:30:20');
-insert into t5 values (1,'09:09:09');
-insert into t5 values (2,'14:30:20');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:20');
-insert into t6 values (2,'21:59:22');
-select second(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select second(col1) from t1 order by col1;
second(col1)
9
20
-select * from t1;
+select * from t1 order by col1;
col1
09:09:09
14:30:20
-select * from t2;
+select * from t2 order by col1;
col1
09:09:09
14:30:20
21:59:22
-select * from t3;
+select * from t3 order by col1;
col1
09:09:09
14:30:20
21:59:22
-select * from t4;
+select * from t4 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t5;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:22:33' where col1='09:09:09';
+update t2 set col1='10:22:33' where col1='09:09:09';
+update t3 set col1='10:22:33' where col1='09:09:09';
+update t4 set col1='10:22:33' where col1='09:09:09';
+update t5 set col1='10:22:33' where col1='09:09:09';
+update t6 set col1='10:22:33' where col1='09:09:09';
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t6;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with second(col1)
-------------------------------------------------------------------------
@@ -2887,33 +8849,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (second('18:30:14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
21:59:22
-select * from t44;
+select * from t44 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t55;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:20';
+delete from t2 where col1='14:30:20';
+delete from t3 where col1='14:30:20';
+delete from t4 where col1='14:30:20';
+delete from t5 where col1='14:30:20';
+delete from t6 where col1='14:30:20';
+select * from t1 order by col1;
+col1
+10:22:33
+select * from t2 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t4 order by colint;
colint col1
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t66;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30:20');
+insert into t2 values ('14:30:20');
+insert into t3 values ('14:30:20');
+insert into t4 values (60,'14:30:20');
+insert into t5 values (60,'14:30:20');
+insert into t6 values (60,'14:30:20');
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+60 14:30:20
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:20';
+delete from t22 where col1='14:30:20';
+delete from t33 where col1='14:30:20';
+delete from t44 where col1='14:30:20';
+delete from t55 where col1='14:30:20';
+delete from t66 where col1='14:30:20';
+select * from t11 order by col1;
+col1
+10:22:33
+select * from t22 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30:20');
+insert into t22 values ('14:30:20');
+insert into t33 values ('14:30:20');
+insert into t44 values (60,'14:30:20');
+insert into t55 values (60,'14:30:20');
+insert into t66 values (60,'14:30:20');
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+60 14:30:20
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2983,44 +9233,83 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:09');
insert into t3 values ('14:30:20');
insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:09');
-insert into t4 values (2,'14:30:20');
-insert into t5 values (1,'09:09:09');
-insert into t5 values (2,'14:30:20');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:20');
-insert into t6 values (2,'21:59:22');
-select second(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select second(col1) from t1 order by col1;
second(col1)
9
20
-select * from t1;
+select * from t1 order by col1;
col1
09:09:09
14:30:20
-select * from t2;
+select * from t2 order by col1;
col1
09:09:09
14:30:20
21:59:22
-select * from t3;
+select * from t3 order by col1;
col1
09:09:09
14:30:20
21:59:22
-select * from t4;
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t6 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+update t1 set col1='10:22:33' where col1='09:09:09';
+update t2 set col1='10:22:33' where col1='09:09:09';
+update t3 set col1='10:22:33' where col1='09:09:09';
+update t4 set col1='10:22:33' where col1='09:09:09';
+update t5 set col1='10:22:33' where col1='09:09:09';
+update t6 set col1='10:22:33' where col1='09:09:09';
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t5;
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t5 order by colint;
colint col1
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t6;
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t6 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
-------------------------------------------------------------------------
--- Alter tables with second(col1)
-------------------------------------------------------------------------
@@ -3070,33 +9359,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (second('18:30:14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
21:59:22
-select * from t44;
+select * from t44 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(30) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t55;
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t66;
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:20';
+delete from t2 where col1='14:30:20';
+delete from t3 where col1='14:30:20';
+delete from t4 where col1='14:30:20';
+delete from t5 where col1='14:30:20';
+delete from t6 where col1='14:30:20';
+select * from t1 order by col1;
+col1
+10:22:33
+select * from t2 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+insert into t1 values ('14:30:20');
+insert into t2 values ('14:30:20');
+insert into t3 values ('14:30:20');
+insert into t4 values (60,'14:30:20');
+insert into t5 values (60,'14:30:20');
+insert into t6 values (60,'14:30:20');
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:20
+select * from t5 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+60 14:30:20
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:20';
+delete from t22 where col1='14:30:20';
+delete from t33 where col1='14:30:20';
+delete from t44 where col1='14:30:20';
+delete from t55 where col1='14:30:20';
+delete from t66 where col1='14:30:20';
+select * from t11 order by col1;
+col1
+10:22:33
+select * from t22 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+insert into t11 values ('14:30:20');
+insert into t22 values ('14:30:20');
+insert into t33 values ('14:30:20');
+insert into t44 values (60,'14:30:20');
+insert into t55 values (60,'14:30:20');
+insert into t66 values (60,'14:30:20');
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+60 14:30:20
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3166,44 +9743,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-12-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-12-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-12-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-12-17');
-insert into t6 values (2,'2006-05-25');
-select month(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select month(col1) from t1 order by col1;
month(col1)
1
12
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-12-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-05-25
2006-12-17
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
+2006-05-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-11-06' where col1='2006-01-03';
+update t2 set col1='2006-11-06' where col1='2006-01-03';
+update t3 set col1='2006-11-06' where col1='2006-01-03';
+update t4 set col1='2006-11-06' where col1='2006-01-03';
+update t5 set col1='2006-11-06' where col1='2006-01-03';
+update t6 set col1='2006-11-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-11-06
2006-12-17
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
2006-05-25
-select * from t4;
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-05-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-12-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with month(col1)
-------------------------------------------------------------------------
@@ -3253,33 +9869,315 @@ alter table t66
partition by range(colint)
(partition p0 values less than (month('2006-10-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
+2006-11-06
2006-12-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-01-03
2006-05-25
+2006-11-06
2006-12-17
-select * from t33;
+select * from t33 order by col1;
col1
-2006-01-03
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+alter table t55
+partition by list(colint)
+subpartition by hash(month(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with month(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-12-17';
+delete from t2 where col1='2006-12-17';
+delete from t3 where col1='2006-12-17';
+delete from t4 where col1='2006-12-17';
+delete from t5 where col1='2006-12-17';
+delete from t6 where col1='2006-12-17';
+select * from t1 order by col1;
+col1
+2006-11-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-12-17');
+insert into t3 values ('2006-12-17');
+insert into t4 values (60,'2006-12-17');
+insert into t5 values (60,'2006-12-17');
+insert into t6 values (60,'2006-12-17');
+select * from t1 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint col1
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+60 2006-12-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with month(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-12-17';
+delete from t22 where col1='2006-12-17';
+delete from t33 where col1='2006-12-17';
+delete from t44 where col1='2006-12-17';
+delete from t55 where col1='2006-12-17';
+delete from t66 where col1='2006-12-17';
+select * from t11 order by col1;
+col1
+2006-11-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-12-17');
+insert into t22 values ('2006-12-17');
+insert into t33 values ('2006-12-17');
+insert into t44 values (60,'2006-12-17');
+insert into t55 values (60,'2006-12-17');
+insert into t66 values (60,'2006-12-17');
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+2006-11-06
2006-12-17
+select * from t33 order by col1;
+col1
2006-05-25
-select * from t44;
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t55;
+60 2006-12-17
+select * from t55 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-05-25
-select * from t66;
+60 2006-12-17
+select * from t66 order by colint;
colint col1
-1 2006-12-17
-2 2006-05-25
+60 2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3349,44 +10247,83 @@ insert into t2 values ('2006-09-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-12-17');
insert into t3 values ('2006-09-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-12-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-12-17');
-insert into t5 values (3,'2006-09-25');
-insert into t6 values (1,'2006-12-17');
-insert into t6 values (2,'2006-09-25');
-select quarter(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select quarter(col1) from t1 order by col1;
quarter(col1)
1
4
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-12-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
-2006-12-17
2006-09-25
-select * from t3;
+2006-12-17
+select * from t3 order by col1;
col1
2006-01-03
+2006-09-25
2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-07-30' where col1='2006-01-03';
+update t2 set col1='2006-07-30' where col1='2006-01-03';
+update t3 set col1='2006-07-30' where col1='2006-01-03';
+update t4 set col1='2006-07-30' where col1='2006-01-03';
+update t5 set col1='2006-07-30' where col1='2006-01-03';
+update t6 set col1='2006-07-30' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-07-30
2006-09-25
-select * from t4;
+2006-12-17
+select * from t4 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-09-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-12-17
-2 2006-09-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with quarter(col1)
-------------------------------------------------------------------------
@@ -3436,33 +10373,313 @@ alter table t66
partition by range(colint)
(partition p0 values less than (quarter('2006-10-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
+2006-07-30
2006-12-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-01-03
+2006-07-30
+2006-09-25
2006-12-17
+select * from t33 order by col1;
+col1
+2006-07-30
2006-09-25
-select * from t33;
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-01-03
+2006-07-30
2006-12-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-07-30
+2006-12-17
+alter table t55
+partition by list(colint)
+subpartition by hash(quarter(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with quarter(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-12-17';
+delete from t2 where col1='2006-12-17';
+delete from t3 where col1='2006-12-17';
+delete from t4 where col1='2006-12-17';
+delete from t5 where col1='2006-12-17';
+delete from t6 where col1='2006-12-17';
+select * from t1 order by col1;
+col1
+2006-07-30
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-12-17');
+insert into t3 values ('2006-12-17');
+insert into t4 values (60,'2006-12-17');
+insert into t5 values (60,'2006-12-17');
+insert into t6 values (60,'2006-12-17');
+select * from t1 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+4 2006-02-05
+60 2006-12-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with quarter(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-12-17';
+delete from t22 where col1='2006-12-17';
+delete from t33 where col1='2006-12-17';
+delete from t44 where col1='2006-12-17';
+delete from t55 where col1='2006-12-17';
+delete from t66 where col1='2006-12-17';
+select * from t11 order by col1;
+col1
+2006-07-30
+select * from t22 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-12-17');
+insert into t22 values ('2006-12-17');
+insert into t33 values ('2006-12-17');
+insert into t44 values (60,'2006-12-17');
+insert into t55 values (60,'2006-12-17');
+insert into t66 values (60,'2006-12-17');
+select * from t11 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-07-30
2006-09-25
-select * from t44;
+2006-12-17
+select * from t44 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t55 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-09-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t66 order by colint;
colint col1
-1 2006-12-17
-2 2006-09-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t44 order by colint;
+colint col1
+60 2006-12-17
+select * from t55 order by colint;
+colint col1
+60 2006-12-17
+select * from t66 order by colint;
+colint col1
+4 2006-02-05
+60 2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3532,44 +10749,83 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:15');
insert into t3 values ('14:30:45');
insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:15');
-insert into t4 values (2,'14:30:45');
-insert into t5 values (1,'09:09:15');
-insert into t5 values (2,'14:30:45');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:45');
-insert into t6 values (2,'21:59:22');
-select time_to_sec(col1)-(time_to_sec(col1)-20) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
time_to_sec(col1)-(time_to_sec(col1)-20)
20
20
-select * from t1;
+select * from t1 order by col1;
col1
09:09:15
14:30:45
-select * from t2;
+select * from t2 order by col1;
col1
09:09:15
14:30:45
21:59:22
-select * from t3;
+select * from t3 order by col1;
col1
09:09:15
14:30:45
21:59:22
-select * from t4;
+select * from t4 order by colint;
colint col1
1 09:09:15
-2 14:30:45
-select * from t5;
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
1 09:09:15
-2 14:30:45
-3 21:59:22
-select * from t6;
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:33:11' where col1='09:09:15';
+update t2 set col1='10:33:11' where col1='09:09:15';
+update t3 set col1='10:33:11' where col1='09:09:15';
+update t4 set col1='10:33:11' where col1='09:09:15';
+update t5 set col1='10:33:11' where col1='09:09:15';
+update t6 set col1='10:33:11' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
-------------------------------------------------------------------------
@@ -3619,33 +10875,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
21:59:22
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 09:09:15
-2 14:30:45
-select * from t55;
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
colint col1
-1 09:09:15
-2 14:30:45
-3 21:59:22
-select * from t66;
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:45';
+delete from t2 where col1='14:30:45';
+delete from t3 where col1='14:30:45';
+delete from t4 where col1='14:30:45';
+delete from t5 where col1='14:30:45';
+delete from t6 where col1='14:30:45';
+select * from t1 order by col1;
+col1
+10:33:11
+select * from t2 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t4 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30:45');
+insert into t2 values ('14:30:45');
+insert into t3 values ('14:30:45');
+insert into t4 values (60,'14:30:45');
+insert into t5 values (60,'14:30:45');
+insert into t6 values (60,'14:30:45');
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:45';
+delete from t22 where col1='14:30:45';
+delete from t33 where col1='14:30:45';
+delete from t44 where col1='14:30:45';
+delete from t55 where col1='14:30:45';
+delete from t66 where col1='14:30:45';
+select * from t11 order by col1;
+col1
+10:33:11
+select * from t22 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30:45');
+insert into t22 values ('14:30:45');
+insert into t33 values ('14:30:45');
+insert into t44 values (60,'14:30:45');
+insert into t55 values (60,'14:30:45');
+insert into t66 values (60,'14:30:45');
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3715,44 +11257,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-02-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-02-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-01-25');
-select to_days(col1)-to_days('2006-01-01') from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
to_days(col1)-to_days('2006-01-01')
-33
16
-select * from t1;
+33
+select * from t1 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t2;
+2006-02-03
+select * from t2 order by col1;
col1
2006-01-17
2006-01-25
2006-02-03
-select * from t3;
+select * from t3 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
colint col1
-2 2006-01-17
1 2006-02-03
-select * from t5;
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
+1 2006-02-03
2 2006-01-17
3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
1 2006-02-03
-select * from t6;
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-06' where col1='2006-02-03';
+update t2 set col1='2006-02-06' where col1='2006-02-03';
+update t3 set col1='2006-02-06' where col1='2006-02-03';
+update t4 set col1='2006-02-06' where col1='2006-02-03';
+update t5 set col1='2006-02-06' where col1='2006-02-03';
+update t6 set col1='2006-02-06' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with to_days(col1)-to_days('2006-01-01')
-------------------------------------------------------------------------
@@ -3802,33 +11383,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t22;
+2006-02-06
+select * from t22 order by col1;
col1
2006-01-17
2006-01-25
-2006-02-03
-select * from t33;
+2006-02-06
+select * from t33 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t44;
+2006-02-06
+select * from t44 order by colint;
colint col1
+1 2006-02-06
2 2006-01-17
-1 2006-02-03
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
+1 2006-02-06
2 2006-01-17
3 2006-01-25
-1 2006-02-03
-select * from t66;
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+alter table t55
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+60 2006-01-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+60 2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3898,44 +11757,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-12-03');
insert into t3 values ('2006-11-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-12-03');
-insert into t4 values (2,'2006-11-17');
-insert into t5 values (1,'2006-12-03');
-insert into t5 values (2,'2006-11-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-11-17');
-insert into t6 values (2,'2006-05-25');
-select weekday(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select weekday(col1) from t1 order by col1;
weekday(col1)
-6
4
-select * from t1;
+6
+select * from t1 order by col1;
col1
+2006-11-17
2006-12-03
+select * from t2 order by col1;
+col1
+2006-05-25
2006-11-17
-select * from t2;
+2006-12-03
+select * from t3 order by col1;
col1
+2006-05-25
+2006-11-17
2006-12-03
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-06' where col1='2006-12-03';
+update t2 set col1='2006-02-06' where col1='2006-12-03';
+update t3 set col1='2006-02-06' where col1='2006-12-03';
+update t4 set col1='2006-02-06' where col1='2006-12-03';
+update t5 set col1='2006-02-06' where col1='2006-12-03';
+update t6 set col1='2006-02-06' where col1='2006-12-03';
+select * from t1 order by col1;
+col1
+2006-02-06
2006-11-17
-2006-05-25
-select * from t3;
+select * from t2 order by col1;
col1
-2006-12-03
+2006-02-06
+2006-05-25
2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t4;
+2006-11-17
+select * from t4 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-3 2006-05-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-11-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with weekday(col1)
-------------------------------------------------------------------------
@@ -3985,33 +11883,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (weekday('2006-10-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-12-03
+2006-02-06
2006-11-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-12-03
+2006-02-06
+2006-05-25
2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t33;
+2006-11-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-12-03
+2006-02-06
2006-11-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+alter table t55
+partition by list(colint)
+subpartition by hash(weekday(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekday(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-11-17';
+delete from t2 where col1='2006-11-17';
+delete from t3 where col1='2006-11-17';
+delete from t4 where col1='2006-11-17';
+delete from t5 where col1='2006-11-17';
+delete from t6 where col1='2006-11-17';
+select * from t1 order by col1;
+col1
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-11-17');
+insert into t2 values ('2006-11-17');
+insert into t3 values ('2006-11-17');
+insert into t4 values (60,'2006-11-17');
+insert into t5 values (60,'2006-11-17');
+insert into t6 values (60,'2006-11-17');
+select * from t1 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+60 2006-11-17
+select * from t5 order by colint;
+colint col1
+60 2006-11-17
+select * from t6 order by colint;
+colint col1
+60 2006-11-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekday(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-11-17';
+delete from t22 where col1='2006-11-17';
+delete from t33 where col1='2006-11-17';
+delete from t44 where col1='2006-11-17';
+delete from t55 where col1='2006-11-17';
+delete from t66 where col1='2006-11-17';
+select * from t11 order by col1;
+col1
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-11-17');
+insert into t22 values ('2006-11-17');
+insert into t33 values ('2006-11-17');
+insert into t44 values (60,'2006-11-17');
+insert into t55 values (60,'2006-11-17');
+insert into t66 values (60,'2006-11-17');
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t44;
+2006-11-17
+select * from t44 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t55 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-3 2006-05-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t66 order by colint;
colint col1
-1 2006-11-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t44 order by colint;
+colint col1
+60 2006-11-17
+select * from t55 order by colint;
+colint col1
+60 2006-11-17
+select * from t66 order by colint;
+colint col1
+60 2006-11-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4081,44 +12257,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-03-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-03-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-03-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-03-17');
-insert into t6 values (2,'2006-05-25');
-select weekofyear(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select weekofyear(col1) from t1 order by col1;
weekofyear(col1)
1
11
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-03-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-03-17
2006-05-25
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
2006-03-17
2006-05-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-3 2006-05-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-03-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-09-06' where col1='2006-01-03';
+update t2 set col1='2006-09-06' where col1='2006-01-03';
+update t3 set col1='2006-09-06' where col1='2006-01-03';
+update t4 set col1='2006-09-06' where col1='2006-01-03';
+update t5 set col1='2006-09-06' where col1='2006-01-03';
+update t6 set col1='2006-09-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with weekofyear(col1)
-------------------------------------------------------------------------
@@ -4168,33 +12383,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (weekofyear('2006-02-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-03-17
-select * from t22;
+2006-09-06
+select * from t22 order by col1;
col1
-2006-01-03
2006-03-17
2006-05-25
-select * from t33;
+2006-09-06
+select * from t33 order by col1;
col1
-2006-01-03
2006-03-17
2006-05-25
-select * from t44;
+2006-09-06
+select * from t44 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-3 2006-05-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-03-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+alter table t55
+partition by list(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-03-17';
+delete from t2 where col1='2006-03-17';
+delete from t3 where col1='2006-03-17';
+delete from t4 where col1='2006-03-17';
+delete from t5 where col1='2006-03-17';
+delete from t6 where col1='2006-03-17';
+select * from t1 order by col1;
+col1
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-03-17');
+insert into t2 values ('2006-03-17');
+insert into t3 values ('2006-03-17');
+insert into t4 values (60,'2006-03-17');
+insert into t5 values (60,'2006-03-17');
+insert into t6 values (60,'2006-03-17');
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+60 2006-03-17
+select * from t5 order by colint;
+colint col1
+60 2006-03-17
+select * from t6 order by colint;
+colint col1
+60 2006-03-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-03-17';
+delete from t22 where col1='2006-03-17';
+delete from t33 where col1='2006-03-17';
+delete from t44 where col1='2006-03-17';
+delete from t55 where col1='2006-03-17';
+delete from t66 where col1='2006-03-17';
+select * from t11 order by col1;
+col1
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-03-17');
+insert into t22 values ('2006-03-17');
+insert into t33 values ('2006-03-17');
+insert into t44 values (60,'2006-03-17');
+insert into t55 values (60,'2006-03-17');
+insert into t66 values (60,'2006-03-17');
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+60 2006-03-17
+select * from t55 order by colint;
+colint col1
+60 2006-03-17
+select * from t66 order by colint;
+colint col1
+60 2006-03-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4264,44 +12765,83 @@ insert into t2 values ('2004-05-25');
insert into t3 values ('1996-01-03');
insert into t3 values ('2000-02-17');
insert into t3 values ('2004-05-25');
-insert into t4 values (1,'1996-01-03');
-insert into t4 values (2,'2000-02-17');
-insert into t5 values (1,'1996-01-03');
-insert into t5 values (2,'2000-02-17');
-insert into t5 values (3,'2004-05-25');
-insert into t6 values (1,'2000-02-17');
-insert into t6 values (2,'2004-05-25');
-select year(col1)-1990 from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select year(col1)-1990 from t1 order by col1;
year(col1)-1990
6
10
-select * from t1;
+select * from t1 order by col1;
col1
1996-01-03
2000-02-17
-select * from t2;
+select * from t2 order by col1;
col1
1996-01-03
2000-02-17
2004-05-25
-select * from t3;
+select * from t3 order by col1;
col1
1996-01-03
2000-02-17
2004-05-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-3 2004-05-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2002-02-15' where col1='1996-01-03';
+update t2 set col1='2002-02-15' where col1='1996-01-03';
+update t3 set col1='2002-02-15' where col1='1996-01-03';
+update t4 set col1='2002-02-15' where col1='1996-01-03';
+update t5 set col1='2002-02-15' where col1='1996-01-03';
+update t6 set col1='2002-02-15' where col1='1996-01-03';
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
colint col1
-1 2000-02-17
-2 2004-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with year(col1)-1990
-------------------------------------------------------------------------
@@ -4351,33 +12891,315 @@ alter table t66
partition by range(colint)
(partition p0 values less than (year('2005-10-14')-1990),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-1996-01-03
2000-02-17
-select * from t22;
+2002-02-15
+select * from t22 order by col1;
col1
-1996-01-03
2000-02-17
+2002-02-15
2004-05-25
-select * from t33;
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+alter table t55
+partition by list(colint)
+subpartition by hash(year(col1)-1990) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with year(col1)-1990
+-------------------------------------------------------------------------
+delete from t1 where col1='2000-02-17';
+delete from t2 where col1='2000-02-17';
+delete from t3 where col1='2000-02-17';
+delete from t4 where col1='2000-02-17';
+delete from t5 where col1='2000-02-17';
+delete from t6 where col1='2000-02-17';
+select * from t1 order by col1;
+col1
+2002-02-15
+select * from t2 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2000-02-17');
+insert into t2 values ('2000-02-17');
+insert into t3 values ('2000-02-17');
+insert into t4 values (60,'2000-02-17');
+insert into t5 values (60,'2000-02-17');
+insert into t6 values (60,'2000-02-17');
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+60 2000-02-17
+select * from t5 order by colint;
+colint col1
+60 2000-02-17
+select * from t6 order by colint;
+colint col1
+60 2000-02-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with year(col1)-1990
+-------------------------------------------------------------------------
+delete from t11 where col1='2000-02-17';
+delete from t22 where col1='2000-02-17';
+delete from t33 where col1='2000-02-17';
+delete from t44 where col1='2000-02-17';
+delete from t55 where col1='2000-02-17';
+delete from t66 where col1='2000-02-17';
+select * from t11 order by col1;
+col1
+2002-02-15
+select * from t22 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2000-02-17');
+insert into t22 values ('2000-02-17');
+insert into t33 values ('2000-02-17');
+insert into t44 values (60,'2000-02-17');
+insert into t55 values (60,'2000-02-17');
+insert into t66 values (60,'2000-02-17');
+select * from t11 order by col1;
col1
-1996-01-03
2000-02-17
+2002-02-15
+select * from t22 order by col1;
+col1
+2000-02-17
+2002-02-15
2004-05-25
-select * from t44;
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t55 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t66 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-3 2004-05-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
colint col1
-1 2000-02-17
-2 2004-05-25
+60 2000-02-17
+select * from t55 order by colint;
+colint col1
+60 2000-02-17
+select * from t66 order by colint;
+colint col1
+60 2000-02-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4447,44 +13269,83 @@ insert into t2 values ('2006-03-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-08-17');
insert into t3 values ('2006-03-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-08-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-08-17');
-insert into t5 values (3,'2006-03-25');
-insert into t6 values (1,'2006-08-17');
-insert into t6 values (2,'2006-03-25');
-select yearweek(col1)-200600 from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select yearweek(col1)-200600 from t1 order by col1;
yearweek(col1)-200600
1
33
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-08-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-03-25
2006-08-17
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
+2006-03-25
2006-08-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-11-15' where col1='2006-01-03';
+update t2 set col1='2006-11-15' where col1='2006-01-03';
+update t3 set col1='2006-11-15' where col1='2006-01-03';
+update t4 set col1='2006-11-15' where col1='2006-01-03';
+update t5 set col1='2006-11-15' where col1='2006-01-03';
+update t6 set col1='2006-11-15' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
2006-03-25
-select * from t4;
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
colint col1
-1 2006-01-03
-2 2006-08-17
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-3 2006-03-25
-1 2006-01-03
-2 2006-08-17
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-08-17
-2 2006-03-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with yearweek(col1)-200600
-------------------------------------------------------------------------
@@ -4534,33 +13395,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (yearweek('2006-10-14')-200600),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-08-17
-select * from t22;
+2006-11-15
+select * from t22 order by col1;
col1
-2006-01-03
2006-03-25
2006-08-17
-select * from t33;
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-01-03
2006-08-17
+2006-11-15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+alter table t55
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-08-17';
+delete from t2 where col1='2006-08-17';
+delete from t3 where col1='2006-08-17';
+delete from t4 where col1='2006-08-17';
+delete from t5 where col1='2006-08-17';
+delete from t6 where col1='2006-08-17';
+select * from t1 order by col1;
+col1
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-08-17');
+insert into t2 values ('2006-08-17');
+insert into t3 values ('2006-08-17');
+insert into t4 values (60,'2006-08-17');
+insert into t5 values (60,'2006-08-17');
+insert into t6 values (60,'2006-08-17');
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
2006-03-25
-select * from t44;
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+60 2006-08-17
+select * from t5 order by colint;
+colint col1
+60 2006-08-17
+select * from t6 order by colint;
+colint col1
+60 2006-08-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-08-17';
+delete from t22 where col1='2006-08-17';
+delete from t33 where col1='2006-08-17';
+delete from t44 where col1='2006-08-17';
+delete from t55 where col1='2006-08-17';
+delete from t66 where col1='2006-08-17';
+select * from t11 order by col1;
+col1
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-08-17');
+insert into t22 values ('2006-08-17');
+insert into t33 values ('2006-08-17');
+insert into t44 values (60,'2006-08-17');
+insert into t55 values (60,'2006-08-17');
+insert into t66 values (60,'2006-08-17');
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
colint col1
-1 2006-01-03
-2 2006-08-17
-select * from t55;
+60 2006-08-17
+select * from t55 order by colint;
colint col1
-3 2006-03-25
-1 2006-01-03
-2 2006-08-17
-select * from t66;
+60 2006-08-17
+select * from t66 order by colint;
colint col1
-1 2006-08-17
-2 2006-03-25
+60 2006-08-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
diff --git a/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result b/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result
index 73d69e5c90a..86742038990 100644
--- a/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result
+++ b/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result
@@ -55,44 +55,329 @@ insert into t2 values (17 );
insert into t3 values (5 );
insert into t3 values (13 );
insert into t3 values (17 );
-insert into t4 values (1,5 );
-insert into t4 values (2,13 );
-insert into t5 values (1,5 );
-insert into t5 values (2,13 );
-insert into t5 values (3,17 );
-insert into t6 values (1,13 );
-insert into t6 values (2,17 );
-select abs(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t6;
+select abs(col1) from t1 order by col1;
abs(col1)
5
13
-select * from t1;
+select * from t1 order by col1;
col1
5
13
-select * from t2;
+select * from t2 order by col1;
col1
5
13
17
-select * from t3;
+select * from t3 order by col1;
col1
5
13
17
-select * from t4;
+select * from t4 order by colint;
colint col1
1 5
2 13
-select * from t5;
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t5 order by colint;
colint col1
1 5
2 13
-3 17
-select * from t6;
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t6 order by colint;
colint col1
-1 13
-2 17
+1 5
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+update t1 set col1=15 where col1=5 ;
+update t2 set col1=15 where col1=5 ;
+update t3 set col1=15 where col1=5 ;
+update t4 set col1=15 where col1=5 ;
+update t5 set col1=15 where col1=5 ;
+update t6 set col1=15 where col1=5 ;
+select * from t1 order by col1;
+col1
+13
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t5 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t6 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
-------------------------------------------------------------------------
--- Alter tables with abs(col1)
-------------------------------------------------------------------------
@@ -142,33 +427,1241 @@ alter table t66
partition by range(colint)
(partition p0 values less than (abs(15)),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-5
13
-select * from t22;
+15
+select * from t22 order by col1;
col1
-5
13
+15
17
-select * from t33;
+select * from t33 order by col1;
col1
-5
13
+15
17
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 5
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t55 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t66 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13
+15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13
+15
+alter table t55
+partition by list(colint)
+subpartition by hash(abs(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15
2 13
-select * from t55;
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 5
+1 15
2 13
-3 17
-select * from t66;
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 13
-2 17
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with abs(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1=13 ;
+delete from t2 where col1=13 ;
+delete from t3 where col1=13 ;
+delete from t4 where col1=13 ;
+delete from t5 where col1=13 ;
+delete from t6 where col1=13 ;
+select * from t1 order by col1;
+col1
+15
+select * from t2 order by col1;
+col1
+15
+17
+select * from t3 order by col1;
+col1
+15
+17
+select * from t4 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t5 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+insert into t1 values (13 );
+insert into t2 values (13 );
+insert into t3 values (13 );
+insert into t4 values (60,13 );
+insert into t5 values (60,13 );
+insert into t6 values (60,13 );
+select * from t1 order by col1;
+col1
+13
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t5 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t6 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t5 order by colint;
+colint col1
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t6 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with abs(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1=13 ;
+delete from t22 where col1=13 ;
+delete from t33 where col1=13 ;
+delete from t44 where col1=13 ;
+delete from t55 where col1=13 ;
+delete from t66 where col1=13 ;
+select * from t11 order by col1;
+col1
+15
+select * from t22 order by col1;
+col1
+15
+17
+select * from t33 order by col1;
+col1
+15
+17
+select * from t44 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t55 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+insert into t11 values (13 );
+insert into t22 values (13 );
+insert into t33 values (13 );
+insert into t44 values (60,13 );
+insert into t55 values (60,13 );
+insert into t66 values (60,13 );
+select * from t11 order by col1;
+col1
+13
+15
+select * from t22 order by col1;
+col1
+13
+15
+17
+select * from t33 order by col1;
+col1
+13
+15
+17
+select * from t44 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t55 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t66 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15
+select * from t22 order by col1;
+col1
+13
+15
+17
+select * from t33 order by col1;
+col1
+13
+15
+17
+select * from t44 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t55 order by colint;
+colint col1
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t66 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -238,44 +1731,83 @@ insert into t2 values ('3');
insert into t3 values ('1');
insert into t3 values ('9');
insert into t3 values ('3');
-insert into t4 values (1,'1');
-insert into t4 values (2,'9');
-insert into t5 values (1,'1');
-insert into t5 values (2,'9');
-insert into t5 values (3,'3');
-insert into t6 values (1,'9');
-insert into t6 values (2,'3');
-select ascii(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
+select ascii(col1) from t1 order by col1;
ascii(col1)
49
57
-select * from t1;
+select * from t1 order by col1;
col1
1
9
-select * from t2;
+select * from t2 order by col1;
col1
1
-9
3
-select * from t3;
+9
+select * from t3 order by col1;
col1
1
-9
3
-select * from t4;
+9
+select * from t4 order by colint;
colint col1
1 1
2 9
-select * from t5;
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t6 order by colint;
colint col1
1 1
2 9
3 3
-select * from t6;
+4 8
+update t1 set col1='8' where col1='1';
+update t2 set col1='8' where col1='1';
+update t3 set col1='8' where col1='1';
+update t4 set col1='8' where col1='1';
+update t5 set col1='8' where col1='1';
+update t6 set col1='8' where col1='1';
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t5 order by colint;
colint col1
-1 9
-2 3
+1 8
+2 9
+3 3
+4 8
+select * from t6 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
-------------------------------------------------------------------------
--- Alter tables with ascii(col1)
-------------------------------------------------------------------------
@@ -325,33 +1857,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (ascii('5')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-1
+8
9
-select * from t22;
+select * from t22 order by col1;
col1
-1
+3
+8
9
+select * from t33 order by col1;
+col1
3
-select * from t33;
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-1
+8
9
-3
-select * from t44;
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t55
+partition by list(colint)
+subpartition by hash(ascii(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ascii(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 1
+1 8
2 9
-select * from t55;
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
2 9
3 3
-select * from t66;
+4 8
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ascii(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='9';
+delete from t2 where col1='9';
+delete from t3 where col1='9';
+delete from t4 where col1='9';
+delete from t5 where col1='9';
+delete from t6 where col1='9';
+select * from t1 order by col1;
+col1
+8
+select * from t2 order by col1;
+col1
+3
+8
+select * from t3 order by col1;
+col1
+3
+8
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t1 values ('9');
+insert into t2 values ('9');
+insert into t3 values ('9');
+insert into t4 values (60,'9');
+insert into t5 values (60,'9');
+insert into t6 values (60,'9');
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
colint col1
-1 9
-2 3
+1 8
+3 3
+4 8
+60 9
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t6 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+60 9
+select * from t5 order by colint;
+colint col1
+60 9
+select * from t6 order by colint;
+colint col1
+60 9
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ascii(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='9';
+delete from t22 where col1='9';
+delete from t33 where col1='9';
+delete from t44 where col1='9';
+delete from t55 where col1='9';
+delete from t66 where col1='9';
+select * from t11 order by col1;
+col1
+8
+select * from t22 order by col1;
+col1
+3
+8
+select * from t33 order by col1;
+col1
+3
+8
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t11 values ('9');
+insert into t22 values ('9');
+insert into t33 values ('9');
+insert into t44 values (60,'9');
+insert into t55 values (60,'9');
+insert into t66 values (60,'9');
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t66 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+60 9
+select * from t55 order by colint;
+colint col1
+60 9
+select * from t66 order by colint;
+colint col1
+60 9
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -421,44 +2231,83 @@ insert into t2 values (17.987);
insert into t3 values (5.1230);
insert into t3 values (13.345);
insert into t3 values (17.987);
-insert into t4 values (1,5.1230);
-insert into t4 values (2,13.345);
-insert into t5 values (1,5.1230);
-insert into t5 values (2,13.345);
-insert into t5 values (3,17.987);
-insert into t6 values (1,13.345);
-insert into t6 values (2,17.987);
-select cast(ceiling(col1) as signed integer) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(ceiling(col1) as signed integer) from t1 order by col1;
cast(ceiling(col1) as signed integer)
6
14
-select * from t1;
+select * from t1 order by col1;
col1
5.1230
13.3450
-select * from t2;
+select * from t2 order by col1;
col1
5.1230
13.3450
17.9870
-select * from t3;
+select * from t3 order by col1;
col1
5.1230
13.3450
17.9870
-select * from t4;
+select * from t4 order by colint;
colint col1
1 5.1230
2 13.3450
-select * from t5;
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
1 5.1230
2 13.3450
3 17.9870
-select * from t6;
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+update t1 set col1=15.654 where col1=5.1230;
+update t2 set col1=15.654 where col1=5.1230;
+update t3 set col1=15.654 where col1=5.1230;
+update t4 set col1=15.654 where col1=5.1230;
+update t5 set col1=15.654 where col1=5.1230;
+update t6 set col1=15.654 where col1=5.1230;
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(ceiling(col1) as signed integer)
-------------------------------------------------------------------------
@@ -508,33 +2357,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (cast(ceiling(15) as signed integer)),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-5.1230
13.3450
-select * from t22;
+15.6540
+select * from t22 order by col1;
col1
-5.1230
13.3450
+15.6540
17.9870
-select * from t33;
+select * from t33 order by col1;
col1
-5.1230
13.3450
+15.6540
17.9870
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 5.1230
+1 15.6540
2 13.3450
-select * from t55;
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
colint col1
-1 5.1230
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` float(7,4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(ceiling(col1) as signed integer)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
2 13.3450
3 17.9870
-select * from t66;
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+delete from t1 where col1=13.345;
+delete from t2 where col1=13.345;
+delete from t3 where col1=13.345;
+delete from t4 where col1=13.345;
+delete from t5 where col1=13.345;
+delete from t6 where col1=13.345;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t1 values (13.345);
+insert into t2 values (13.345);
+insert into t3 values (13.345);
+insert into t4 values (60,13.345);
+insert into t5 values (60,13.345);
+insert into t6 values (60,13.345);
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t6 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+60 13.3450
+select * from t5 order by colint;
+colint col1
+60 13.3450
+select * from t6 order by colint;
+colint col1
+60 13.3450
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+delete from t11 where col1=13.345;
+delete from t22 where col1=13.345;
+delete from t33 where col1=13.345;
+delete from t44 where col1=13.345;
+delete from t55 where col1=13.345;
+delete from t66 where col1=13.345;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t11 values (13.345);
+insert into t22 values (13.345);
+insert into t33 values (13.345);
+insert into t44 values (60,13.345);
+insert into t55 values (60,13.345);
+insert into t66 values (60,13.345);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t66 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+60 13.3450
+select * from t55 order by colint;
+colint col1
+60 13.3450
+select * from t66 order by colint;
+colint col1
+60 13.3450
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -604,44 +2729,83 @@ insert into t2 values (17.987);
insert into t3 values (5.1230);
insert into t3 values (13.345);
insert into t3 values (17.987);
-insert into t4 values (1,5.1230);
-insert into t4 values (2,13.345);
-insert into t5 values (1,5.1230);
-insert into t5 values (2,13.345);
-insert into t5 values (3,17.987);
-insert into t6 values (1,13.345);
-insert into t6 values (2,17.987);
-select cast(floor(col1) as signed) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(floor(col1) as signed) from t1 order by col1;
cast(floor(col1) as signed)
5
13
-select * from t1;
+select * from t1 order by col1;
col1
5.1230
13.3450
-select * from t2;
+select * from t2 order by col1;
col1
5.1230
13.3450
17.9870
-select * from t3;
+select * from t3 order by col1;
col1
5.1230
13.3450
17.9870
-select * from t4;
+select * from t4 order by colint;
colint col1
1 5.1230
2 13.3450
-select * from t5;
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
1 5.1230
2 13.3450
3 17.9870
-select * from t6;
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+update t1 set col1=15.654 where col1=5.1230;
+update t2 set col1=15.654 where col1=5.1230;
+update t3 set col1=15.654 where col1=5.1230;
+update t4 set col1=15.654 where col1=5.1230;
+update t5 set col1=15.654 where col1=5.1230;
+update t6 set col1=15.654 where col1=5.1230;
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(floor(col1) as signed)
-------------------------------------------------------------------------
@@ -691,33 +2855,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (cast(floor(15.123) as signed)),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-5.1230
13.3450
-select * from t22;
+15.6540
+select * from t22 order by col1;
col1
-5.1230
13.3450
+15.6540
17.9870
-select * from t33;
+select * from t33 order by col1;
col1
-5.1230
13.3450
+15.6540
17.9870
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 5.1230
+1 15.6540
2 13.3450
-select * from t55;
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
colint col1
-1 5.1230
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` float(7,4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(floor(col1) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
2 13.3450
3 17.9870
-select * from t66;
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+delete from t1 where col1=13.345;
+delete from t2 where col1=13.345;
+delete from t3 where col1=13.345;
+delete from t4 where col1=13.345;
+delete from t5 where col1=13.345;
+delete from t6 where col1=13.345;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t1 values (13.345);
+insert into t2 values (13.345);
+insert into t3 values (13.345);
+insert into t4 values (60,13.345);
+insert into t5 values (60,13.345);
+insert into t6 values (60,13.345);
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t6 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+60 13.3450
+select * from t5 order by colint;
+colint col1
+60 13.3450
+select * from t6 order by colint;
+colint col1
+60 13.3450
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+delete from t11 where col1=13.345;
+delete from t22 where col1=13.345;
+delete from t33 where col1=13.345;
+delete from t44 where col1=13.345;
+delete from t55 where col1=13.345;
+delete from t66 where col1=13.345;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t11 values (13.345);
+insert into t22 values (13.345);
+insert into t33 values (13.345);
+insert into t44 values (60,13.345);
+insert into t55 values (60,13.345);
+insert into t66 values (60,13.345);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t66 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+60 13.3450
+select * from t55 order by colint;
+colint col1
+60 13.3450
+select * from t66 order by colint;
+colint col1
+60 13.3450
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -787,44 +3227,83 @@ insert into t2 values (17);
insert into t3 values (5.0000);
insert into t3 values (19);
insert into t3 values (17);
-insert into t4 values (1,5.0000);
-insert into t4 values (2,19);
-insert into t5 values (1,5.0000);
-insert into t5 values (2,19);
-insert into t5 values (3,17);
-insert into t6 values (1,19);
-insert into t6 values (2,17);
-select cast(mod(col1,10) as signed) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(mod(col1,10) as signed) from t1 order by col1;
cast(mod(col1,10) as signed)
5
9
-select * from t1;
+select * from t1 order by col1;
col1
5.0000
19.0000
-select * from t2;
+select * from t2 order by col1;
col1
5.0000
-19.0000
17.0000
-select * from t3;
+19.0000
+select * from t3 order by col1;
col1
5.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+update t1 set col1=15 where col1=5.0000;
+update t2 set col1=15 where col1=5.0000;
+update t3 set col1=15 where col1=5.0000;
+update t4 set col1=15 where col1=5.0000;
+update t5 set col1=15 where col1=5.0000;
+update t6 set col1=15 where col1=5.0000;
+select * from t1 order by col1;
+col1
+15.0000
+19.0000
+select * from t2 order by col1;
+col1
+15.0000
+17.0000
19.0000
+select * from t3 order by col1;
+col1
+15.0000
17.0000
-select * from t4;
+19.0000
+select * from t4 order by colint;
colint col1
-1 5.0000
-2 19.0000
-select * from t5;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
-1 5.0000
-2 19.0000
-3 17.0000
-select * from t6;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 19.0000
-2 17.0000
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(mod(col1,10) as signed)
-------------------------------------------------------------------------
@@ -874,33 +3353,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (cast(mod(15,10) as signed)),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-5.0000
+15.0000
19.0000
-select * from t22;
+select * from t22 order by col1;
col1
-5.0000
+15.0000
+17.0000
19.0000
+select * from t33 order by col1;
+col1
+15.0000
17.0000
-select * from t33;
+19.0000
+select * from t44 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-5.0000
+15.0000
19.0000
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` float(7,4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(mod(col1,10) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+delete from t1 where col1=19;
+delete from t2 where col1=19;
+delete from t3 where col1=19;
+delete from t4 where col1=19;
+delete from t5 where col1=19;
+delete from t6 where col1=19;
+select * from t1 order by col1;
+col1
+15.0000
+select * from t2 order by col1;
+col1
+15.0000
17.0000
-select * from t44;
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+select * from t4 order by colint;
colint col1
-1 5.0000
-2 19.0000
-select * from t55;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
-1 5.0000
-2 19.0000
-3 17.0000
-select * from t66;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+insert into t1 values (19);
+insert into t2 values (19);
+insert into t3 values (19);
+insert into t4 values (60,19);
+insert into t5 values (60,19);
+insert into t6 values (60,19);
+select * from t1 order by col1;
+col1
+15.0000
+19.0000
+select * from t2 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t6 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+60 19.0000
+select * from t5 order by colint;
+colint col1
+60 19.0000
+select * from t6 order by colint;
+colint col1
+60 19.0000
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+delete from t11 where col1=19;
+delete from t22 where col1=19;
+delete from t33 where col1=19;
+delete from t44 where col1=19;
+delete from t55 where col1=19;
+delete from t66 where col1=19;
+select * from t11 order by col1;
+col1
+15.0000
+select * from t22 order by col1;
+col1
+15.0000
+17.0000
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+select * from t44 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+insert into t11 values (19);
+insert into t22 values (19);
+insert into t33 values (19);
+insert into t44 values (60,19);
+insert into t55 values (60,19);
+insert into t66 values (60,19);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+select * from t22 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t44 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t44 order by colint;
+colint col1
+60 19.0000
+select * from t55 order by colint;
+colint col1
+60 19.0000
+select * from t66 order by colint;
colint col1
-1 19.0000
-2 17.0000
+60 19.0000
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -970,44 +3727,83 @@ insert into t2 values ('3');
insert into t3 values ('1');
insert into t3 values ('9');
insert into t3 values ('3');
-insert into t4 values (1,'1');
-insert into t4 values (2,'9');
-insert into t5 values (1,'1');
-insert into t5 values (2,'9');
-insert into t5 values (3,'3');
-insert into t6 values (1,'9');
-insert into t6 values (2,'3');
-select ord(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
+select ord(col1) from t1 order by col1;
ord(col1)
49
57
-select * from t1;
+select * from t1 order by col1;
col1
1
9
-select * from t2;
+select * from t2 order by col1;
col1
1
-9
3
-select * from t3;
+9
+select * from t3 order by col1;
col1
1
-9
3
-select * from t4;
+9
+select * from t4 order by colint;
colint col1
1 1
2 9
-select * from t5;
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t6 order by colint;
colint col1
1 1
2 9
3 3
-select * from t6;
+4 8
+update t1 set col1='8' where col1='1';
+update t2 set col1='8' where col1='1';
+update t3 set col1='8' where col1='1';
+update t4 set col1='8' where col1='1';
+update t5 set col1='8' where col1='1';
+update t6 set col1='8' where col1='1';
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t5 order by colint;
colint col1
-1 9
-2 3
+1 8
+2 9
+3 3
+4 8
+select * from t6 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
-------------------------------------------------------------------------
--- Alter tables with ord(col1)
-------------------------------------------------------------------------
@@ -1057,33 +3853,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (ord('a')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-1
+8
9
-select * from t22;
+select * from t22 order by col1;
col1
-1
+3
+8
9
+select * from t33 order by col1;
+col1
3
-select * from t33;
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-1
+8
9
-3
-select * from t44;
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t55
+partition by list(colint)
+subpartition by hash(ord(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(3) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ord(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 1
+1 8
2 9
-select * from t55;
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 1
+1 8
2 9
3 3
-select * from t66;
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ord(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='9';
+delete from t2 where col1='9';
+delete from t3 where col1='9';
+delete from t4 where col1='9';
+delete from t5 where col1='9';
+delete from t6 where col1='9';
+select * from t1 order by col1;
+col1
+8
+select * from t2 order by col1;
+col1
+3
+8
+select * from t3 order by col1;
+col1
+3
+8
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t1 values ('9');
+insert into t2 values ('9');
+insert into t3 values ('9');
+insert into t4 values (60,'9');
+insert into t5 values (60,'9');
+insert into t6 values (60,'9');
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t6 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+60 9
+select * from t5 order by colint;
+colint col1
+60 9
+select * from t6 order by colint;
colint col1
-1 9
-2 3
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ord(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='9';
+delete from t22 where col1='9';
+delete from t33 where col1='9';
+delete from t44 where col1='9';
+delete from t55 where col1='9';
+delete from t66 where col1='9';
+select * from t11 order by col1;
+col1
+8
+select * from t22 order by col1;
+col1
+3
+8
+select * from t33 order by col1;
+col1
+3
+8
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t11 values ('9');
+insert into t22 values ('9');
+insert into t33 values ('9');
+insert into t44 values (60,'9');
+insert into t55 values (60,'9');
+insert into t66 values (60,'9');
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t66 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+60 9
+select * from t55 order by colint;
+colint col1
+60 9
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1153,44 +4225,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-02-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-02-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-01-25');
-select day(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select day(col1) from t1 order by col1;
day(col1)
-3
17
-select * from t1;
+3
+select * from t1 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t2;
-col1
2006-02-03
+select * from t2 order by col1;
+col1
2006-01-17
2006-01-25
-select * from t3;
-col1
2006-02-03
+select * from t3 order by col1;
+col1
2006-01-17
2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
-select * from t5;
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
3 2006-01-25
-select * from t6;
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-02-03';
+update t2 set col1='2006-02-05' where col1='2006-02-03';
+update t3 set col1='2006-02-05' where col1='2006-02-03';
+update t4 set col1='2006-02-05' where col1='2006-02-03';
+update t5 set col1='2006-02-05' where col1='2006-02-03';
+update t6 set col1='2006-02-05' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with day(col1)
-------------------------------------------------------------------------
@@ -1240,33 +4351,307 @@ alter table t66
partition by range(colint)
(partition p0 values less than (day('2006-12-21')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t33;
+2006-02-05
+select * from t33 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t44;
+2006-02-05
+select * from t44 order by colint;
colint col1
-1 2006-02-03
+1 2006-02-05
2 2006-01-17
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-1 2006-02-03
+1 2006-02-05
2 2006-01-17
3 2006-01-25
-select * from t66;
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(day(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with day(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+60 2006-01-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with day(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+60 2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1336,44 +4721,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-02-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-02-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-01-25');
-select dayofmonth(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofmonth(col1) from t1 order by col1;
dayofmonth(col1)
-3
17
-select * from t1;
+3
+select * from t1 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t2;
-col1
2006-02-03
+select * from t2 order by col1;
+col1
2006-01-17
2006-01-25
-select * from t3;
-col1
2006-02-03
+select * from t3 order by col1;
+col1
2006-01-17
2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
-select * from t5;
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
3 2006-01-25
-select * from t6;
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-02-03';
+update t2 set col1='2006-02-05' where col1='2006-02-03';
+update t3 set col1='2006-02-05' where col1='2006-02-03';
+update t4 set col1='2006-02-05' where col1='2006-02-03';
+update t5 set col1='2006-02-05' where col1='2006-02-03';
+update t6 set col1='2006-02-05' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with dayofmonth(col1)
-------------------------------------------------------------------------
@@ -1423,33 +4847,307 @@ alter table t66
partition by range(colint)
(partition p0 values less than (dayofmonth('2006-12-24')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t33;
+2006-02-05
+select * from t33 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t44;
+2006-02-05
+select * from t44 order by colint;
colint col1
-1 2006-02-03
+1 2006-02-05
2 2006-01-17
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-1 2006-02-03
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
2 2006-01-17
3 2006-01-25
-select * from t66;
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+60 2006-01-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+60 2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1519,44 +5217,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-02-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-02-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-02-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-02-17');
-insert into t6 values (2,'2006-01-25');
-select dayofweek(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofweek(col1) from t1 order by col1;
dayofweek(col1)
3
6
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-02-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
-2006-02-17
2006-01-25
-select * from t3;
+2006-02-17
+select * from t3 order by col1;
col1
2006-01-03
+2006-01-25
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-02-05
2006-02-17
+select * from t2 order by col1;
+col1
2006-01-25
-select * from t4;
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-2 2006-02-17
+1 2006-02-03
+2 2006-01-17
3 2006-01-25
-1 2006-01-03
-select * from t6;
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-02-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with dayofweek(col1)
-------------------------------------------------------------------------
@@ -1606,33 +5343,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (dayofweek('2006-12-24')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
+2006-02-05
2006-02-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-01-03
+2006-01-25
+2006-02-05
2006-02-17
+select * from t33 order by col1;
+col1
2006-01-25
-select * from t33;
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-01-03
+2006-02-05
2006-02-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofweek(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-02-17';
+delete from t2 where col1='2006-02-17';
+delete from t3 where col1='2006-02-17';
+delete from t4 where col1='2006-02-17';
+delete from t5 where col1='2006-02-17';
+delete from t6 where col1='2006-02-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-02-17');
+insert into t3 values ('2006-02-17');
+insert into t4 values (60,'2006-02-17');
+insert into t5 values (60,'2006-02-17');
+insert into t6 values (60,'2006-02-17');
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
2006-01-25
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t55;
+60 2006-02-17
+select * from t5 order by colint;
colint col1
-2 2006-02-17
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
3 2006-01-25
-1 2006-01-03
-select * from t66;
+4 2006-02-05
+60 2006-02-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofweek(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-02-17';
+delete from t22 where col1='2006-02-17';
+delete from t33 where col1='2006-02-17';
+delete from t44 where col1='2006-02-17';
+delete from t55 where col1='2006-02-17';
+delete from t66 where col1='2006-02-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-1 2006-02-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-02-17');
+insert into t22 values ('2006-02-17');
+insert into t33 values ('2006-02-17');
+insert into t44 values (60,'2006-02-17');
+insert into t55 values (60,'2006-02-17');
+insert into t66 values (60,'2006-02-17');
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1702,44 +5725,83 @@ insert into t2 values ('2006-02-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-02-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-02-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-02-25');
-select dayofyear(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofyear(col1) from t1 order by col1;
dayofyear(col1)
3
17
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-01-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-01-17
2006-02-25
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
2006-01-17
2006-02-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t5;
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-3 2006-02-25
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t6;
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-02-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with dayofyear(col1)
-------------------------------------------------------------------------
@@ -1789,33 +5851,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (dayofyear('2006-12-25')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
col1
-2006-01-03
2006-01-17
+2006-02-05
2006-02-25
-select * from t33;
+select * from t33 order by col1;
col1
-2006-01-03
2006-01-17
+2006-02-05
2006-02-25
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-3 2006-02-25
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t66;
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-01-17
-2 2006-02-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -1885,44 +6223,83 @@ insert into t2 values ('2006-02-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-02-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-02-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-02-25');
-select dayofyear(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofyear(col1) from t1 order by col1;
dayofyear(col1)
3
17
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-01-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-01-17
2006-02-25
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
2006-01-17
2006-02-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 2006-01-03
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
2 2006-01-17
-select * from t5;
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-3 2006-02-25
-1 2006-01-03
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
2 2006-01-17
-select * from t6;
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-02-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with dayofyear(col1)
-------------------------------------------------------------------------
@@ -1972,33 +6349,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (dayofyear('2006-12-25')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
col1
-2006-01-03
2006-01-17
+2006-02-05
2006-02-25
-select * from t33;
+select * from t33 order by col1;
col1
-2006-01-03
2006-01-17
+2006-02-05
2006-02-25
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-3 2006-02-25
-1 2006-01-03
+1 2006-02-03
2 2006-01-17
-select * from t66;
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-01-17
-2 2006-02-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2068,44 +6721,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-02-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-02-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-02-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-02-17');
-insert into t6 values (2,'2006-01-25');
-select extract(month from col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select extract(month from col1) from t1 order by col1;
extract(month from col1)
1
2
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-02-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
-2006-02-17
2006-01-25
-select * from t3;
+2006-02-17
+select * from t3 order by col1;
col1
2006-01-03
+2006-01-25
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
2006-02-17
+select * from t3 order by col1;
+col1
2006-01-25
-select * from t4;
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
+1 2006-02-03
+2 2006-01-17
3 2006-01-25
-select * from t6;
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-02-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with extract(month from col1)
-------------------------------------------------------------------------
@@ -2155,33 +6847,309 @@ alter table t66
partition by range(colint)
(partition p0 values less than (extract(year from '1998-11-23')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
+2006-02-05
2006-02-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-01-03
+2006-01-25
+2006-02-05
2006-02-17
+select * from t33 order by col1;
+col1
2006-01-25
-select * from t33;
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-01-03
+2006-02-05
+2006-02-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+alter table t55
+partition by list(colint)
+subpartition by hash(extract(month from col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with extract(month from col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-02-17';
+delete from t2 where col1='2006-02-17';
+delete from t3 where col1='2006-02-17';
+delete from t4 where col1='2006-02-17';
+delete from t5 where col1='2006-02-17';
+delete from t6 where col1='2006-02-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-02-17');
+insert into t3 values ('2006-02-17');
+insert into t4 values (60,'2006-02-17');
+insert into t5 values (60,'2006-02-17');
+insert into t6 values (60,'2006-02-17');
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
2006-02-17
+select * from t3 order by col1;
+col1
2006-01-25
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t5 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
+1 2006-02-03
+2 2006-01-17
3 2006-01-25
-select * from t66;
+4 2006-02-05
+60 2006-02-17
+select * from t6 order by colint;
colint col1
-1 2006-02-17
-2 2006-01-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+60 2006-02-17
+select * from t5 order by colint;
+colint col1
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with extract(month from col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-02-17';
+delete from t22 where col1='2006-02-17';
+delete from t33 where col1='2006-02-17';
+delete from t44 where col1='2006-02-17';
+delete from t55 where col1='2006-02-17';
+delete from t66 where col1='2006-02-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-02-17');
+insert into t22 values ('2006-02-17');
+insert into t33 values ('2006-02-17');
+insert into t44 values (60,'2006-02-17');
+insert into t55 values (60,'2006-02-17');
+insert into t66 values (60,'2006-02-17');
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2251,44 +7219,83 @@ insert into t2 values ('21:59');
insert into t3 values ('09:09');
insert into t3 values ('14:30');
insert into t3 values ('21:59');
-insert into t4 values (1,'09:09');
-insert into t4 values (2,'14:30');
-insert into t5 values (1,'09:09');
-insert into t5 values (2,'14:30');
-insert into t5 values (3,'21:59');
-insert into t6 values (1,'14:30');
-insert into t6 values (2,'21:59');
-select hour(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select hour(col1) from t1 order by col1;
hour(col1)
9
14
-select * from t1;
+select * from t1 order by col1;
col1
09:09:00
14:30:00
-select * from t2;
+select * from t2 order by col1;
col1
09:09:00
14:30:00
21:59:00
-select * from t3;
+select * from t3 order by col1;
col1
09:09:00
14:30:00
21:59:00
-select * from t4;
+select * from t4 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-select * from t5;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-3 21:59:00
-select * from t6;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:30' where col1='09:09';
+update t2 set col1='10:30' where col1='09:09';
+update t3 set col1='10:30' where col1='09:09';
+update t4 set col1='10:30' where col1='09:09';
+update t5 set col1='10:30' where col1='09:09';
+update t6 set col1='10:30' where col1='09:09';
+select * from t1 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
colint col1
-1 14:30:00
-2 21:59:00
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with hour(col1)
-------------------------------------------------------------------------
@@ -2338,33 +7345,315 @@ alter table t66
partition by range(colint)
(partition p0 values less than (hour('18:30')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:00
+10:30:00
14:30:00
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:00
+10:30:00
14:30:00
21:59:00
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:00
+10:30:00
+14:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+alter table t55
+partition by list(colint)
+subpartition by hash(hour(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with hour(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30';
+delete from t2 where col1='14:30';
+delete from t3 where col1='14:30';
+delete from t4 where col1='14:30';
+delete from t5 where col1='14:30';
+delete from t6 where col1='14:30';
+select * from t1 order by col1;
+col1
+10:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30');
+insert into t2 values ('14:30');
+insert into t3 values ('14:30');
+insert into t4 values (60,'14:30');
+insert into t5 values (60,'14:30');
+insert into t6 values (60,'14:30');
+select * from t1 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+60 14:30:00
+select * from t5 order by colint;
+colint col1
+60 14:30:00
+select * from t6 order by colint;
+colint col1
+60 14:30:00
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with hour(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30';
+delete from t22 where col1='14:30';
+delete from t33 where col1='14:30';
+delete from t44 where col1='14:30';
+delete from t55 where col1='14:30';
+delete from t66 where col1='14:30';
+select * from t11 order by col1;
+col1
+10:30:00
+select * from t22 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30');
+insert into t22 values ('14:30');
+insert into t33 values ('14:30');
+insert into t44 values (60,'14:30');
+insert into t55 values (60,'14:30');
+insert into t66 values (60,'14:30');
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t22 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+14:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
14:30:00
21:59:00
-select * from t44;
+select * from t44 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-select * from t55;
+60 14:30:00
+select * from t55 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-3 21:59:00
-select * from t66;
+60 14:30:00
+select * from t66 order by colint;
colint col1
-1 14:30:00
-2 21:59:00
+60 14:30:00
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2434,44 +7723,83 @@ insert into t2 values ('00:59:22.000024');
insert into t3 values ('09:09:15.000002');
insert into t3 values ('04:30:01.000018');
insert into t3 values ('00:59:22.000024');
-insert into t4 values (1,'09:09:15.000002');
-insert into t4 values (2,'04:30:01.000018');
-insert into t5 values (1,'09:09:15.000002');
-insert into t5 values (2,'04:30:01.000018');
-insert into t5 values (3,'00:59:22.000024');
-insert into t6 values (1,'04:30:01.000018');
-insert into t6 values (2,'00:59:22.000024');
-select microsecond(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select microsecond(col1) from t1 order by col1;
microsecond(col1)
0
0
-select * from t1;
+select * from t1 order by col1;
col1
+04:30:01
09:09:15
+select * from t2 order by col1;
+col1
+00:59:22
04:30:01
-select * from t2;
+09:09:15
+select * from t3 order by col1;
col1
+00:59:22
+04:30:01
09:09:15
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t2 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t3 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t4 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t5 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t6 set col1='05:30:34.000037' where col1='09:09:15.000002';
+select * from t1 order by col1;
+col1
04:30:01
-00:59:22
-select * from t3;
+05:30:34
+select * from t2 order by col1;
col1
-09:09:15
+00:59:22
04:30:01
+05:30:34
+select * from t3 order by col1;
+col1
00:59:22
-select * from t4;
+04:30:01
+05:30:34
+select * from t4 order by colint;
colint col1
-1 09:09:15
+1 05:30:34
2 04:30:01
-select * from t5;
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-1 09:09:15
+1 05:30:34
2 04:30:01
3 00:59:22
-select * from t6;
+4 05:30:34
+select * from t6 order by colint;
colint col1
-1 04:30:01
-2 00:59:22
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with microsecond(col1)
-------------------------------------------------------------------------
@@ -2521,33 +7849,301 @@ alter table t66
partition by range(colint)
(partition p0 values less than (microsecond('10:30:10.000010')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:15
04:30:01
-select * from t22;
+05:30:34
+select * from t22 order by col1;
col1
-09:09:15
+00:59:22
04:30:01
+05:30:34
+select * from t33 order by col1;
+col1
00:59:22
-select * from t33;
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-09:09:15
04:30:01
-00:59:22
-select * from t44;
+05:30:34
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+alter table t55
+partition by list(colint)
+subpartition by hash(microsecond(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 09:09:15
+1 05:30:34
2 04:30:01
-select * from t55;
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 09:09:15
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 05:30:34
2 04:30:01
3 00:59:22
-select * from t66;
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with microsecond(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='04:30:01.000018';
+delete from t2 where col1='04:30:01.000018';
+delete from t3 where col1='04:30:01.000018';
+delete from t4 where col1='04:30:01.000018';
+delete from t5 where col1='04:30:01.000018';
+delete from t6 where col1='04:30:01.000018';
+select * from t1 order by col1;
+col1
+05:30:34
+select * from t2 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t3 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t4 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-1 04:30:01
-2 00:59:22
+1 05:30:34
+3 00:59:22
+4 05:30:34
+insert into t1 values ('04:30:01.000018');
+insert into t2 values ('04:30:01.000018');
+insert into t3 values ('04:30:01.000018');
+insert into t4 values (60,'04:30:01.000018');
+insert into t5 values (60,'04:30:01.000018');
+insert into t6 values (60,'04:30:01.000018');
+select * from t1 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t2 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t4 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t5 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t6 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t4 order by colint;
+colint col1
+60 04:30:01
+select * from t5 order by colint;
+colint col1
+60 04:30:01
+select * from t6 order by colint;
+colint col1
+60 04:30:01
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with microsecond(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='04:30:01.000018';
+delete from t22 where col1='04:30:01.000018';
+delete from t33 where col1='04:30:01.000018';
+delete from t44 where col1='04:30:01.000018';
+delete from t55 where col1='04:30:01.000018';
+delete from t66 where col1='04:30:01.000018';
+select * from t11 order by col1;
+col1
+05:30:34
+select * from t22 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t33 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t44 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+insert into t11 values ('04:30:01.000018');
+insert into t22 values ('04:30:01.000018');
+insert into t33 values ('04:30:01.000018');
+insert into t44 values (60,'04:30:01.000018');
+insert into t55 values (60,'04:30:01.000018');
+insert into t66 values (60,'04:30:01.000018');
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t22 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t33 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint col1
+60 04:30:01
+select * from t55 order by colint;
+colint col1
+60 04:30:01
+select * from t66 order by colint;
+colint col1
+60 04:30:01
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2617,44 +8213,83 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:15');
insert into t3 values ('14:30:45');
insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:15');
-insert into t4 values (2,'14:30:45');
-insert into t5 values (1,'09:09:15');
-insert into t5 values (2,'14:30:45');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:45');
-insert into t6 values (2,'21:59:22');
-select minute(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select minute(col1) from t1 order by col1;
minute(col1)
9
30
-select * from t1;
+select * from t1 order by col1;
col1
09:09:15
14:30:45
-select * from t2;
+select * from t2 order by col1;
col1
09:09:15
14:30:45
21:59:22
-select * from t3;
+select * from t3 order by col1;
col1
09:09:15
14:30:45
21:59:22
-select * from t4;
+select * from t4 order by colint;
colint col1
-2 14:30:45
1 09:09:15
-select * from t5;
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-2 14:30:45
1 09:09:15
-3 21:59:22
-select * from t6;
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:24:23' where col1='09:09:15';
+update t2 set col1='10:24:23' where col1='09:09:15';
+update t3 set col1='10:24:23' where col1='09:09:15';
+update t4 set col1='10:24:23' where col1='09:09:15';
+update t5 set col1='10:24:23' where col1='09:09:15';
+update t6 set col1='10:24:23' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with minute(col1)
-------------------------------------------------------------------------
@@ -2704,33 +8339,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (minute('18:30')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:15
+10:24:23
14:30:45
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:15
+10:24:23
14:30:45
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:15
+10:24:23
14:30:45
21:59:22
-select * from t44;
+select * from t44 order by colint;
colint col1
-2 14:30:45
-1 09:09:15
-select * from t55;
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
colint col1
-2 14:30:45
-1 09:09:15
-3 21:59:22
-select * from t66;
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(minute(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with minute(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:45';
+delete from t2 where col1='14:30:45';
+delete from t3 where col1='14:30:45';
+delete from t4 where col1='14:30:45';
+delete from t5 where col1='14:30:45';
+delete from t6 where col1='14:30:45';
+select * from t1 order by col1;
+col1
+10:24:23
+select * from t2 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30:45');
+insert into t2 values ('14:30:45');
+insert into t3 values ('14:30:45');
+insert into t4 values (60,'14:30:45');
+insert into t5 values (60,'14:30:45');
+insert into t6 values (60,'14:30:45');
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+60 14:30:45
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with minute(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:45';
+delete from t22 where col1='14:30:45';
+delete from t33 where col1='14:30:45';
+delete from t44 where col1='14:30:45';
+delete from t55 where col1='14:30:45';
+delete from t66 where col1='14:30:45';
+select * from t11 order by col1;
+col1
+10:24:23
+select * from t22 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30:45');
+insert into t22 values ('14:30:45');
+insert into t33 values ('14:30:45');
+insert into t44 values (60,'14:30:45');
+insert into t55 values (60,'14:30:45');
+insert into t66 values (60,'14:30:45');
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t22 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t22 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+60 14:30:45
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2800,44 +8723,83 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:09');
insert into t3 values ('14:30:20');
insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:09');
-insert into t4 values (2,'14:30:20');
-insert into t5 values (1,'09:09:09');
-insert into t5 values (2,'14:30:20');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:20');
-insert into t6 values (2,'21:59:22');
-select second(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select second(col1) from t1 order by col1;
second(col1)
9
20
-select * from t1;
+select * from t1 order by col1;
col1
09:09:09
14:30:20
-select * from t2;
+select * from t2 order by col1;
col1
09:09:09
14:30:20
21:59:22
-select * from t3;
+select * from t3 order by col1;
col1
09:09:09
14:30:20
21:59:22
-select * from t4;
+select * from t4 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t5;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:22:33' where col1='09:09:09';
+update t2 set col1='10:22:33' where col1='09:09:09';
+update t3 set col1='10:22:33' where col1='09:09:09';
+update t4 set col1='10:22:33' where col1='09:09:09';
+update t5 set col1='10:22:33' where col1='09:09:09';
+update t6 set col1='10:22:33' where col1='09:09:09';
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t6;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with second(col1)
-------------------------------------------------------------------------
@@ -2887,33 +8849,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (second('18:30:14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
21:59:22
-select * from t44;
+select * from t44 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t55;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:20';
+delete from t2 where col1='14:30:20';
+delete from t3 where col1='14:30:20';
+delete from t4 where col1='14:30:20';
+delete from t5 where col1='14:30:20';
+delete from t6 where col1='14:30:20';
+select * from t1 order by col1;
+col1
+10:22:33
+select * from t2 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t4 order by colint;
colint col1
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t66;
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30:20');
+insert into t2 values ('14:30:20');
+insert into t3 values ('14:30:20');
+insert into t4 values (60,'14:30:20');
+insert into t5 values (60,'14:30:20');
+insert into t6 values (60,'14:30:20');
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+60 14:30:20
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:20';
+delete from t22 where col1='14:30:20';
+delete from t33 where col1='14:30:20';
+delete from t44 where col1='14:30:20';
+delete from t55 where col1='14:30:20';
+delete from t66 where col1='14:30:20';
+select * from t11 order by col1;
+col1
+10:22:33
+select * from t22 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30:20');
+insert into t22 values ('14:30:20');
+insert into t33 values ('14:30:20');
+insert into t44 values (60,'14:30:20');
+insert into t55 values (60,'14:30:20');
+insert into t66 values (60,'14:30:20');
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+60 14:30:20
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -2983,44 +9233,83 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:09');
insert into t3 values ('14:30:20');
insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:09');
-insert into t4 values (2,'14:30:20');
-insert into t5 values (1,'09:09:09');
-insert into t5 values (2,'14:30:20');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:20');
-insert into t6 values (2,'21:59:22');
-select second(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select second(col1) from t1 order by col1;
second(col1)
9
20
-select * from t1;
+select * from t1 order by col1;
col1
09:09:09
14:30:20
-select * from t2;
+select * from t2 order by col1;
col1
09:09:09
14:30:20
21:59:22
-select * from t3;
+select * from t3 order by col1;
col1
09:09:09
14:30:20
21:59:22
-select * from t4;
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t6 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+update t1 set col1='10:22:33' where col1='09:09:09';
+update t2 set col1='10:22:33' where col1='09:09:09';
+update t3 set col1='10:22:33' where col1='09:09:09';
+update t4 set col1='10:22:33' where col1='09:09:09';
+update t5 set col1='10:22:33' where col1='09:09:09';
+update t6 set col1='10:22:33' where col1='09:09:09';
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t5;
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t5 order by colint;
colint col1
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t6;
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t6 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
-------------------------------------------------------------------------
--- Alter tables with second(col1)
-------------------------------------------------------------------------
@@ -3070,33 +9359,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (second('18:30:14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:09
+10:22:33
14:30:20
21:59:22
-select * from t44;
+select * from t44 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t55;
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t66;
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:20';
+delete from t2 where col1='14:30:20';
+delete from t3 where col1='14:30:20';
+delete from t4 where col1='14:30:20';
+delete from t5 where col1='14:30:20';
+delete from t6 where col1='14:30:20';
+select * from t1 order by col1;
+col1
+10:22:33
+select * from t2 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+insert into t1 values ('14:30:20');
+insert into t2 values ('14:30:20');
+insert into t3 values ('14:30:20');
+insert into t4 values (60,'14:30:20');
+insert into t5 values (60,'14:30:20');
+insert into t6 values (60,'14:30:20');
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:20
+select * from t5 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+60 14:30:20
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:20';
+delete from t22 where col1='14:30:20';
+delete from t33 where col1='14:30:20';
+delete from t44 where col1='14:30:20';
+delete from t55 where col1='14:30:20';
+delete from t66 where col1='14:30:20';
+select * from t11 order by col1;
+col1
+10:22:33
+select * from t22 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+insert into t11 values ('14:30:20');
+insert into t22 values ('14:30:20');
+insert into t33 values ('14:30:20');
+insert into t44 values (60,'14:30:20');
+insert into t55 values (60,'14:30:20');
+insert into t66 values (60,'14:30:20');
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+60 14:30:20
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3166,44 +9743,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-12-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-12-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-12-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-12-17');
-insert into t6 values (2,'2006-05-25');
-select month(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select month(col1) from t1 order by col1;
month(col1)
1
12
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-12-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-05-25
2006-12-17
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
+2006-05-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-11-06' where col1='2006-01-03';
+update t2 set col1='2006-11-06' where col1='2006-01-03';
+update t3 set col1='2006-11-06' where col1='2006-01-03';
+update t4 set col1='2006-11-06' where col1='2006-01-03';
+update t5 set col1='2006-11-06' where col1='2006-01-03';
+update t6 set col1='2006-11-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-11-06
2006-12-17
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
2006-05-25
-select * from t4;
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-05-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-12-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with month(col1)
-------------------------------------------------------------------------
@@ -3253,33 +9869,315 @@ alter table t66
partition by range(colint)
(partition p0 values less than (month('2006-10-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
+2006-11-06
2006-12-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-01-03
2006-05-25
+2006-11-06
2006-12-17
-select * from t33;
+select * from t33 order by col1;
col1
-2006-01-03
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+alter table t55
+partition by list(colint)
+subpartition by hash(month(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with month(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-12-17';
+delete from t2 where col1='2006-12-17';
+delete from t3 where col1='2006-12-17';
+delete from t4 where col1='2006-12-17';
+delete from t5 where col1='2006-12-17';
+delete from t6 where col1='2006-12-17';
+select * from t1 order by col1;
+col1
+2006-11-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-12-17');
+insert into t3 values ('2006-12-17');
+insert into t4 values (60,'2006-12-17');
+insert into t5 values (60,'2006-12-17');
+insert into t6 values (60,'2006-12-17');
+select * from t1 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint col1
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+60 2006-12-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with month(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-12-17';
+delete from t22 where col1='2006-12-17';
+delete from t33 where col1='2006-12-17';
+delete from t44 where col1='2006-12-17';
+delete from t55 where col1='2006-12-17';
+delete from t66 where col1='2006-12-17';
+select * from t11 order by col1;
+col1
+2006-11-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-12-17');
+insert into t22 values ('2006-12-17');
+insert into t33 values ('2006-12-17');
+insert into t44 values (60,'2006-12-17');
+insert into t55 values (60,'2006-12-17');
+insert into t66 values (60,'2006-12-17');
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+2006-11-06
2006-12-17
+select * from t33 order by col1;
+col1
2006-05-25
-select * from t44;
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t55;
+60 2006-12-17
+select * from t55 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-05-25
-select * from t66;
+60 2006-12-17
+select * from t66 order by colint;
colint col1
-1 2006-12-17
-2 2006-05-25
+60 2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3349,44 +10247,83 @@ insert into t2 values ('2006-09-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-12-17');
insert into t3 values ('2006-09-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-12-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-12-17');
-insert into t5 values (3,'2006-09-25');
-insert into t6 values (1,'2006-12-17');
-insert into t6 values (2,'2006-09-25');
-select quarter(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select quarter(col1) from t1 order by col1;
quarter(col1)
1
4
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-12-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
-2006-12-17
2006-09-25
-select * from t3;
+2006-12-17
+select * from t3 order by col1;
col1
2006-01-03
+2006-09-25
2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-07-30' where col1='2006-01-03';
+update t2 set col1='2006-07-30' where col1='2006-01-03';
+update t3 set col1='2006-07-30' where col1='2006-01-03';
+update t4 set col1='2006-07-30' where col1='2006-01-03';
+update t5 set col1='2006-07-30' where col1='2006-01-03';
+update t6 set col1='2006-07-30' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-07-30
2006-09-25
-select * from t4;
+2006-12-17
+select * from t4 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-09-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-12-17
-2 2006-09-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with quarter(col1)
-------------------------------------------------------------------------
@@ -3436,33 +10373,313 @@ alter table t66
partition by range(colint)
(partition p0 values less than (quarter('2006-10-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
+2006-07-30
2006-12-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-01-03
+2006-07-30
+2006-09-25
2006-12-17
+select * from t33 order by col1;
+col1
+2006-07-30
2006-09-25
-select * from t33;
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-01-03
+2006-07-30
2006-12-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-07-30
+2006-12-17
+alter table t55
+partition by list(colint)
+subpartition by hash(quarter(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with quarter(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-12-17';
+delete from t2 where col1='2006-12-17';
+delete from t3 where col1='2006-12-17';
+delete from t4 where col1='2006-12-17';
+delete from t5 where col1='2006-12-17';
+delete from t6 where col1='2006-12-17';
+select * from t1 order by col1;
+col1
+2006-07-30
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-12-17');
+insert into t3 values ('2006-12-17');
+insert into t4 values (60,'2006-12-17');
+insert into t5 values (60,'2006-12-17');
+insert into t6 values (60,'2006-12-17');
+select * from t1 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+4 2006-02-05
+60 2006-12-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with quarter(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-12-17';
+delete from t22 where col1='2006-12-17';
+delete from t33 where col1='2006-12-17';
+delete from t44 where col1='2006-12-17';
+delete from t55 where col1='2006-12-17';
+delete from t66 where col1='2006-12-17';
+select * from t11 order by col1;
+col1
+2006-07-30
+select * from t22 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-12-17');
+insert into t22 values ('2006-12-17');
+insert into t33 values ('2006-12-17');
+insert into t44 values (60,'2006-12-17');
+insert into t55 values (60,'2006-12-17');
+insert into t66 values (60,'2006-12-17');
+select * from t11 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-07-30
2006-09-25
-select * from t44;
+2006-12-17
+select * from t44 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t55 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-09-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t66 order by colint;
colint col1
-1 2006-12-17
-2 2006-09-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t44 order by colint;
+colint col1
+60 2006-12-17
+select * from t55 order by colint;
+colint col1
+60 2006-12-17
+select * from t66 order by colint;
+colint col1
+4 2006-02-05
+60 2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3532,44 +10749,83 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:15');
insert into t3 values ('14:30:45');
insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:15');
-insert into t4 values (2,'14:30:45');
-insert into t5 values (1,'09:09:15');
-insert into t5 values (2,'14:30:45');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:45');
-insert into t6 values (2,'21:59:22');
-select time_to_sec(col1)-(time_to_sec(col1)-20) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
time_to_sec(col1)-(time_to_sec(col1)-20)
20
20
-select * from t1;
+select * from t1 order by col1;
col1
09:09:15
14:30:45
-select * from t2;
+select * from t2 order by col1;
col1
09:09:15
14:30:45
21:59:22
-select * from t3;
+select * from t3 order by col1;
col1
09:09:15
14:30:45
21:59:22
-select * from t4;
+select * from t4 order by colint;
colint col1
1 09:09:15
-2 14:30:45
-select * from t5;
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
colint col1
1 09:09:15
-2 14:30:45
-3 21:59:22
-select * from t6;
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:33:11' where col1='09:09:15';
+update t2 set col1='10:33:11' where col1='09:09:15';
+update t3 set col1='10:33:11' where col1='09:09:15';
+update t4 set col1='10:33:11' where col1='09:09:15';
+update t5 set col1='10:33:11' where col1='09:09:15';
+update t6 set col1='10:33:11' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
-------------------------------------------------------------------------
@@ -3619,33 +10875,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
21:59:22
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 09:09:15
-2 14:30:45
-select * from t55;
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
colint col1
-1 09:09:15
-2 14:30:45
-3 21:59:22
-select * from t66;
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:45';
+delete from t2 where col1='14:30:45';
+delete from t3 where col1='14:30:45';
+delete from t4 where col1='14:30:45';
+delete from t5 where col1='14:30:45';
+delete from t6 where col1='14:30:45';
+select * from t1 order by col1;
+col1
+10:33:11
+select * from t2 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t4 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30:45');
+insert into t2 values ('14:30:45');
+insert into t3 values ('14:30:45');
+insert into t4 values (60,'14:30:45');
+insert into t5 values (60,'14:30:45');
+insert into t6 values (60,'14:30:45');
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:45';
+delete from t22 where col1='14:30:45';
+delete from t33 where col1='14:30:45';
+delete from t44 where col1='14:30:45';
+delete from t55 where col1='14:30:45';
+delete from t66 where col1='14:30:45';
+select * from t11 order by col1;
+col1
+10:33:11
+select * from t22 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30:45');
+insert into t22 values ('14:30:45');
+insert into t33 values ('14:30:45');
+insert into t44 values (60,'14:30:45');
+insert into t55 values (60,'14:30:45');
+insert into t66 values (60,'14:30:45');
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3715,44 +11257,83 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-02-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-02-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-01-25');
-select to_days(col1)-to_days('2006-01-01') from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
to_days(col1)-to_days('2006-01-01')
-33
16
-select * from t1;
+33
+select * from t1 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t2;
+2006-02-03
+select * from t2 order by col1;
col1
2006-01-17
2006-01-25
2006-02-03
-select * from t3;
+select * from t3 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
colint col1
-2 2006-01-17
1 2006-02-03
-select * from t5;
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
+1 2006-02-03
2 2006-01-17
3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
1 2006-02-03
-select * from t6;
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-06' where col1='2006-02-03';
+update t2 set col1='2006-02-06' where col1='2006-02-03';
+update t3 set col1='2006-02-06' where col1='2006-02-03';
+update t4 set col1='2006-02-06' where col1='2006-02-03';
+update t5 set col1='2006-02-06' where col1='2006-02-03';
+update t6 set col1='2006-02-06' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with to_days(col1)-to_days('2006-01-01')
-------------------------------------------------------------------------
@@ -3802,33 +11383,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t22;
+2006-02-06
+select * from t22 order by col1;
col1
2006-01-17
2006-01-25
-2006-02-03
-select * from t33;
+2006-02-06
+select * from t33 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t44;
+2006-02-06
+select * from t44 order by colint;
colint col1
+1 2006-02-06
2 2006-01-17
-1 2006-02-03
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
+1 2006-02-06
2 2006-01-17
3 2006-01-25
-1 2006-02-03
-select * from t66;
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+alter table t55
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+60 2006-01-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+60 2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3898,44 +11757,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-12-03');
insert into t3 values ('2006-11-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-12-03');
-insert into t4 values (2,'2006-11-17');
-insert into t5 values (1,'2006-12-03');
-insert into t5 values (2,'2006-11-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-11-17');
-insert into t6 values (2,'2006-05-25');
-select weekday(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select weekday(col1) from t1 order by col1;
weekday(col1)
-6
4
-select * from t1;
+6
+select * from t1 order by col1;
col1
+2006-11-17
2006-12-03
+select * from t2 order by col1;
+col1
+2006-05-25
2006-11-17
-select * from t2;
+2006-12-03
+select * from t3 order by col1;
col1
+2006-05-25
+2006-11-17
2006-12-03
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-06' where col1='2006-12-03';
+update t2 set col1='2006-02-06' where col1='2006-12-03';
+update t3 set col1='2006-02-06' where col1='2006-12-03';
+update t4 set col1='2006-02-06' where col1='2006-12-03';
+update t5 set col1='2006-02-06' where col1='2006-12-03';
+update t6 set col1='2006-02-06' where col1='2006-12-03';
+select * from t1 order by col1;
+col1
+2006-02-06
2006-11-17
-2006-05-25
-select * from t3;
+select * from t2 order by col1;
col1
-2006-12-03
+2006-02-06
+2006-05-25
2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t4;
+2006-11-17
+select * from t4 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-3 2006-05-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-11-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with weekday(col1)
-------------------------------------------------------------------------
@@ -3985,33 +11883,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (weekday('2006-10-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-12-03
+2006-02-06
2006-11-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-12-03
+2006-02-06
+2006-05-25
2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t33;
+2006-11-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-12-03
+2006-02-06
2006-11-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+alter table t55
+partition by list(colint)
+subpartition by hash(weekday(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekday(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-11-17';
+delete from t2 where col1='2006-11-17';
+delete from t3 where col1='2006-11-17';
+delete from t4 where col1='2006-11-17';
+delete from t5 where col1='2006-11-17';
+delete from t6 where col1='2006-11-17';
+select * from t1 order by col1;
+col1
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-11-17');
+insert into t2 values ('2006-11-17');
+insert into t3 values ('2006-11-17');
+insert into t4 values (60,'2006-11-17');
+insert into t5 values (60,'2006-11-17');
+insert into t6 values (60,'2006-11-17');
+select * from t1 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+60 2006-11-17
+select * from t5 order by colint;
+colint col1
+60 2006-11-17
+select * from t6 order by colint;
+colint col1
+60 2006-11-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekday(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-11-17';
+delete from t22 where col1='2006-11-17';
+delete from t33 where col1='2006-11-17';
+delete from t44 where col1='2006-11-17';
+delete from t55 where col1='2006-11-17';
+delete from t66 where col1='2006-11-17';
+select * from t11 order by col1;
+col1
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-11-17');
+insert into t22 values ('2006-11-17');
+insert into t33 values ('2006-11-17');
+insert into t44 values (60,'2006-11-17');
+insert into t55 values (60,'2006-11-17');
+insert into t66 values (60,'2006-11-17');
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t44;
+2006-11-17
+select * from t44 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t55 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-3 2006-05-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t66 order by colint;
colint col1
-1 2006-11-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t44 order by colint;
+colint col1
+60 2006-11-17
+select * from t55 order by colint;
+colint col1
+60 2006-11-17
+select * from t66 order by colint;
+colint col1
+60 2006-11-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4081,44 +12257,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-03-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-03-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-03-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-03-17');
-insert into t6 values (2,'2006-05-25');
-select weekofyear(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select weekofyear(col1) from t1 order by col1;
weekofyear(col1)
1
11
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-03-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-03-17
2006-05-25
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
2006-03-17
2006-05-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-3 2006-05-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-03-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-09-06' where col1='2006-01-03';
+update t2 set col1='2006-09-06' where col1='2006-01-03';
+update t3 set col1='2006-09-06' where col1='2006-01-03';
+update t4 set col1='2006-09-06' where col1='2006-01-03';
+update t5 set col1='2006-09-06' where col1='2006-01-03';
+update t6 set col1='2006-09-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with weekofyear(col1)
-------------------------------------------------------------------------
@@ -4168,33 +12383,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (weekofyear('2006-02-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-03-17
-select * from t22;
+2006-09-06
+select * from t22 order by col1;
col1
-2006-01-03
2006-03-17
2006-05-25
-select * from t33;
+2006-09-06
+select * from t33 order by col1;
col1
-2006-01-03
2006-03-17
2006-05-25
-select * from t44;
+2006-09-06
+select * from t44 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-3 2006-05-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-03-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+alter table t55
+partition by list(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-03-17';
+delete from t2 where col1='2006-03-17';
+delete from t3 where col1='2006-03-17';
+delete from t4 where col1='2006-03-17';
+delete from t5 where col1='2006-03-17';
+delete from t6 where col1='2006-03-17';
+select * from t1 order by col1;
+col1
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-03-17');
+insert into t2 values ('2006-03-17');
+insert into t3 values ('2006-03-17');
+insert into t4 values (60,'2006-03-17');
+insert into t5 values (60,'2006-03-17');
+insert into t6 values (60,'2006-03-17');
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+60 2006-03-17
+select * from t5 order by colint;
+colint col1
+60 2006-03-17
+select * from t6 order by colint;
+colint col1
+60 2006-03-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-03-17';
+delete from t22 where col1='2006-03-17';
+delete from t33 where col1='2006-03-17';
+delete from t44 where col1='2006-03-17';
+delete from t55 where col1='2006-03-17';
+delete from t66 where col1='2006-03-17';
+select * from t11 order by col1;
+col1
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-03-17');
+insert into t22 values ('2006-03-17');
+insert into t33 values ('2006-03-17');
+insert into t44 values (60,'2006-03-17');
+insert into t55 values (60,'2006-03-17');
+insert into t66 values (60,'2006-03-17');
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+60 2006-03-17
+select * from t55 order by colint;
+colint col1
+60 2006-03-17
+select * from t66 order by colint;
+colint col1
+60 2006-03-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4264,44 +12765,83 @@ insert into t2 values ('2004-05-25');
insert into t3 values ('1996-01-03');
insert into t3 values ('2000-02-17');
insert into t3 values ('2004-05-25');
-insert into t4 values (1,'1996-01-03');
-insert into t4 values (2,'2000-02-17');
-insert into t5 values (1,'1996-01-03');
-insert into t5 values (2,'2000-02-17');
-insert into t5 values (3,'2004-05-25');
-insert into t6 values (1,'2000-02-17');
-insert into t6 values (2,'2004-05-25');
-select year(col1)-1990 from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select year(col1)-1990 from t1 order by col1;
year(col1)-1990
6
10
-select * from t1;
+select * from t1 order by col1;
col1
1996-01-03
2000-02-17
-select * from t2;
+select * from t2 order by col1;
col1
1996-01-03
2000-02-17
2004-05-25
-select * from t3;
+select * from t3 order by col1;
col1
1996-01-03
2000-02-17
2004-05-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-3 2004-05-25
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2002-02-15' where col1='1996-01-03';
+update t2 set col1='2002-02-15' where col1='1996-01-03';
+update t3 set col1='2002-02-15' where col1='1996-01-03';
+update t4 set col1='2002-02-15' where col1='1996-01-03';
+update t5 set col1='2002-02-15' where col1='1996-01-03';
+update t6 set col1='2002-02-15' where col1='1996-01-03';
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
colint col1
-1 2000-02-17
-2 2004-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with year(col1)-1990
-------------------------------------------------------------------------
@@ -4351,33 +12891,315 @@ alter table t66
partition by range(colint)
(partition p0 values less than (year('2005-10-14')-1990),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-1996-01-03
2000-02-17
-select * from t22;
+2002-02-15
+select * from t22 order by col1;
col1
-1996-01-03
2000-02-17
+2002-02-15
2004-05-25
-select * from t33;
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+alter table t55
+partition by list(colint)
+subpartition by hash(year(col1)-1990) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with year(col1)-1990
+-------------------------------------------------------------------------
+delete from t1 where col1='2000-02-17';
+delete from t2 where col1='2000-02-17';
+delete from t3 where col1='2000-02-17';
+delete from t4 where col1='2000-02-17';
+delete from t5 where col1='2000-02-17';
+delete from t6 where col1='2000-02-17';
+select * from t1 order by col1;
+col1
+2002-02-15
+select * from t2 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2000-02-17');
+insert into t2 values ('2000-02-17');
+insert into t3 values ('2000-02-17');
+insert into t4 values (60,'2000-02-17');
+insert into t5 values (60,'2000-02-17');
+insert into t6 values (60,'2000-02-17');
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+60 2000-02-17
+select * from t5 order by colint;
+colint col1
+60 2000-02-17
+select * from t6 order by colint;
+colint col1
+60 2000-02-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with year(col1)-1990
+-------------------------------------------------------------------------
+delete from t11 where col1='2000-02-17';
+delete from t22 where col1='2000-02-17';
+delete from t33 where col1='2000-02-17';
+delete from t44 where col1='2000-02-17';
+delete from t55 where col1='2000-02-17';
+delete from t66 where col1='2000-02-17';
+select * from t11 order by col1;
+col1
+2002-02-15
+select * from t22 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2000-02-17');
+insert into t22 values ('2000-02-17');
+insert into t33 values ('2000-02-17');
+insert into t44 values (60,'2000-02-17');
+insert into t55 values (60,'2000-02-17');
+insert into t66 values (60,'2000-02-17');
+select * from t11 order by col1;
col1
-1996-01-03
2000-02-17
+2002-02-15
+select * from t22 order by col1;
+col1
+2000-02-17
+2002-02-15
2004-05-25
-select * from t44;
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t55 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t66 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-3 2004-05-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
colint col1
-1 2000-02-17
-2 2004-05-25
+60 2000-02-17
+select * from t55 order by colint;
+colint col1
+60 2000-02-17
+select * from t66 order by colint;
+colint col1
+60 2000-02-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4447,44 +13269,83 @@ insert into t2 values ('2006-03-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-08-17');
insert into t3 values ('2006-03-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-08-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-08-17');
-insert into t5 values (3,'2006-03-25');
-insert into t6 values (1,'2006-08-17');
-insert into t6 values (2,'2006-03-25');
-select yearweek(col1)-200600 from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select yearweek(col1)-200600 from t1 order by col1;
yearweek(col1)-200600
1
33
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-08-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-03-25
2006-08-17
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
+2006-03-25
2006-08-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-11-15' where col1='2006-01-03';
+update t2 set col1='2006-11-15' where col1='2006-01-03';
+update t3 set col1='2006-11-15' where col1='2006-01-03';
+update t4 set col1='2006-11-15' where col1='2006-01-03';
+update t5 set col1='2006-11-15' where col1='2006-01-03';
+update t6 set col1='2006-11-15' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
2006-03-25
-select * from t4;
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
colint col1
-1 2006-01-03
-2 2006-08-17
-select * from t5;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
colint col1
-3 2006-03-25
-1 2006-01-03
-2 2006-08-17
-select * from t6;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-08-17
-2 2006-03-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with yearweek(col1)-200600
-------------------------------------------------------------------------
@@ -4534,33 +13395,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (yearweek('2006-10-14')-200600),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-08-17
-select * from t22;
+2006-11-15
+select * from t22 order by col1;
col1
-2006-01-03
2006-03-25
2006-08-17
-select * from t33;
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
col1
-2006-01-03
2006-08-17
+2006-11-15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+alter table t55
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-08-17';
+delete from t2 where col1='2006-08-17';
+delete from t3 where col1='2006-08-17';
+delete from t4 where col1='2006-08-17';
+delete from t5 where col1='2006-08-17';
+delete from t6 where col1='2006-08-17';
+select * from t1 order by col1;
+col1
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-08-17');
+insert into t2 values ('2006-08-17');
+insert into t3 values ('2006-08-17');
+insert into t4 values (60,'2006-08-17');
+insert into t5 values (60,'2006-08-17');
+insert into t6 values (60,'2006-08-17');
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
2006-03-25
-select * from t44;
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+60 2006-08-17
+select * from t5 order by colint;
+colint col1
+60 2006-08-17
+select * from t6 order by colint;
+colint col1
+60 2006-08-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-08-17';
+delete from t22 where col1='2006-08-17';
+delete from t33 where col1='2006-08-17';
+delete from t44 where col1='2006-08-17';
+delete from t55 where col1='2006-08-17';
+delete from t66 where col1='2006-08-17';
+select * from t11 order by col1;
+col1
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-08-17');
+insert into t22 values ('2006-08-17');
+insert into t33 values ('2006-08-17');
+insert into t44 values (60,'2006-08-17');
+insert into t55 values (60,'2006-08-17');
+insert into t66 values (60,'2006-08-17');
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
colint col1
-1 2006-01-03
-2 2006-08-17
-select * from t55;
+60 2006-08-17
+select * from t55 order by colint;
colint col1
-3 2006-03-25
-1 2006-01-03
-2 2006-08-17
-select * from t66;
+60 2006-08-17
+select * from t66 order by colint;
colint col1
-1 2006-08-17
-2 2006-03-25
+60 2006-08-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
diff --git a/mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result b/mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result
new file mode 100644
index 00000000000..5dc27d16538
--- /dev/null
+++ b/mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result
@@ -0,0 +1,13724 @@
+-------------------------------------------------------------------------
+--- abs(col1) in partition with coltype int
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with abs(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 int) engine='NDB'
+partition by range(abs(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 int) engine='NDB'
+partition by list(abs(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 int) engine='NDB'
+partition by hash(abs(col1));
+create table t4 (colint int, col1 int) engine='NDB'
+partition by range(colint)
+subpartition by hash(abs(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 int) engine='NDB'
+partition by list(colint)
+subpartition by hash(abs(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 int) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with abs(col1)
+-------------------------------------------------------------------------
+insert into t1 values (5 );
+insert into t1 values (13 );
+insert into t2 values (5 );
+insert into t2 values (13 );
+insert into t2 values (17 );
+insert into t3 values (5 );
+insert into t3 values (13 );
+insert into t3 values (17 );
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t6;
+select abs(col1) from t1 order by col1;
+abs(col1)
+5
+13
+select * from t1 order by col1;
+col1
+5
+13
+select * from t2 order by col1;
+col1
+5
+13
+17
+select * from t3 order by col1;
+col1
+5
+13
+17
+select * from t4 order by colint;
+colint col1
+1 5
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t5 order by colint;
+colint col1
+1 5
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t6 order by colint;
+colint col1
+1 5
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 5
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+update t1 set col1=15 where col1=5 ;
+update t2 set col1=15 where col1=5 ;
+update t3 set col1=15 where col1=5 ;
+update t4 set col1=15 where col1=5 ;
+update t5 set col1=15 where col1=5 ;
+update t6 set col1=15 where col1=5 ;
+select * from t1 order by col1;
+col1
+13
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t5 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t6 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+-------------------------------------------------------------------------
+--- Alter tables with abs(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(abs(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(abs(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(abs(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(abs(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(abs(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13
+15
+select * from t22 order by col1;
+col1
+13
+15
+17
+select * from t33 order by col1;
+col1
+13
+15
+17
+select * from t44 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t55 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t66 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13
+15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13
+15
+alter table t55
+partition by list(colint)
+subpartition by hash(abs(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` int(11) DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15
+2 13
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with abs(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1=13 ;
+delete from t2 where col1=13 ;
+delete from t3 where col1=13 ;
+delete from t4 where col1=13 ;
+delete from t5 where col1=13 ;
+delete from t6 where col1=13 ;
+select * from t1 order by col1;
+col1
+15
+select * from t2 order by col1;
+col1
+15
+17
+select * from t3 order by col1;
+col1
+15
+17
+select * from t4 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t5 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+insert into t1 values (13 );
+insert into t2 values (13 );
+insert into t3 values (13 );
+insert into t4 values (60,13 );
+insert into t5 values (60,13 );
+insert into t6 values (60,13 );
+select * from t1 order by col1;
+col1
+13
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t5 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t6 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t5 order by colint;
+colint col1
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t6 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with abs(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1=13 ;
+delete from t22 where col1=13 ;
+delete from t33 where col1=13 ;
+delete from t44 where col1=13 ;
+delete from t55 where col1=13 ;
+delete from t66 where col1=13 ;
+select * from t11 order by col1;
+col1
+15
+select * from t22 order by col1;
+col1
+15
+17
+select * from t33 order by col1;
+col1
+15
+17
+select * from t44 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+select * from t55 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+insert into t11 values (13 );
+insert into t22 values (13 );
+insert into t33 values (13 );
+insert into t44 values (60,13 );
+insert into t55 values (60,13 );
+insert into t66 values (60,13 );
+select * from t11 order by col1;
+col1
+13
+15
+select * from t22 order by col1;
+col1
+13
+15
+17
+select * from t33 order by col1;
+col1
+13
+15
+17
+select * from t44 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t55 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t66 order by colint;
+colint col1
+1 15
+3 15
+4 17
+5 23
+6 34
+7 56
+8 56
+9 45
+10 34
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15
+select * from t22 order by col1;
+col1
+13
+15
+17
+select * from t33 order by col1;
+col1
+13
+15
+17
+select * from t44 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t55 order by colint;
+colint col1
+11 78
+12 89
+13 67
+14 46
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+select * from t66 order by colint;
+colint col1
+15 34
+16 324
+17 345
+18 34
+19 78
+20 567
+21 4
+22 435
+23 34
+24 45
+25 4565
+26 4
+27 3
+28 2
+29 3
+30 15
+31 6
+32 8
+33 9
+34 745
+35 34
+36 34
+37 324
+38 67
+39 78
+40 89
+41 90
+42 78967
+50 56
+51 34
+55 123
+60 13
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- ascii(col1) in partition with coltype char(1)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with ascii(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 char(1)) engine='NDB'
+partition by range(ascii(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 char(1)) engine='NDB'
+partition by list(ascii(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 char(1)) engine='NDB'
+partition by hash(ascii(col1));
+create table t4 (colint int, col1 char(1)) engine='NDB'
+partition by range(colint)
+subpartition by hash(ascii(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 char(1)) engine='NDB'
+partition by list(colint)
+subpartition by hash(ascii(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 char(1)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with ascii(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('1');
+insert into t1 values ('9');
+insert into t2 values ('1');
+insert into t2 values ('9');
+insert into t2 values ('3');
+insert into t3 values ('1');
+insert into t3 values ('9');
+insert into t3 values ('3');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
+select ascii(col1) from t1 order by col1;
+ascii(col1)
+49
+57
+select * from t1 order by col1;
+col1
+1
+9
+select * from t2 order by col1;
+col1
+1
+3
+9
+select * from t3 order by col1;
+col1
+1
+3
+9
+select * from t4 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t6 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+update t1 set col1='8' where col1='1';
+update t2 set col1='8' where col1='1';
+update t3 set col1='8' where col1='1';
+update t4 set col1='8' where col1='1';
+update t5 set col1='8' where col1='1';
+update t6 set col1='8' where col1='1';
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t6 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+-------------------------------------------------------------------------
+--- Alter tables with ascii(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(ascii(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(ascii(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(ascii(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(ascii(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(ascii(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t55
+partition by list(colint)
+subpartition by hash(ascii(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(1) DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ascii(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ascii(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='9';
+delete from t2 where col1='9';
+delete from t3 where col1='9';
+delete from t4 where col1='9';
+delete from t5 where col1='9';
+delete from t6 where col1='9';
+select * from t1 order by col1;
+col1
+8
+select * from t2 order by col1;
+col1
+3
+8
+select * from t3 order by col1;
+col1
+3
+8
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t1 values ('9');
+insert into t2 values ('9');
+insert into t3 values ('9');
+insert into t4 values (60,'9');
+insert into t5 values (60,'9');
+insert into t6 values (60,'9');
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t6 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+60 9
+select * from t5 order by colint;
+colint col1
+60 9
+select * from t6 order by colint;
+colint col1
+60 9
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ascii(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='9';
+delete from t22 where col1='9';
+delete from t33 where col1='9';
+delete from t44 where col1='9';
+delete from t55 where col1='9';
+delete from t66 where col1='9';
+select * from t11 order by col1;
+col1
+8
+select * from t22 order by col1;
+col1
+3
+8
+select * from t33 order by col1;
+col1
+3
+8
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t11 values ('9');
+insert into t22 values ('9');
+insert into t33 values ('9');
+insert into t44 values (60,'9');
+insert into t55 values (60,'9');
+insert into t66 values (60,'9');
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t66 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+60 9
+select * from t55 order by colint;
+colint col1
+60 9
+select * from t66 order by colint;
+colint col1
+60 9
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- cast(ceiling(col1) as signed integer) in partition with coltype float(7,4)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+create table t1 (col1 float(7,4)) engine='NDB'
+partition by range(cast(ceiling(col1) as signed integer))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 float(7,4)) engine='NDB'
+partition by list(cast(ceiling(col1) as signed integer))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 float(7,4)) engine='NDB'
+partition by hash(cast(ceiling(col1) as signed integer));
+create table t4 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 float(7,4)) engine='NDB'
+partition by list(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+insert into t1 values (5.1230);
+insert into t1 values (13.345);
+insert into t2 values (5.1230);
+insert into t2 values (13.345);
+insert into t2 values (17.987);
+insert into t3 values (5.1230);
+insert into t3 values (13.345);
+insert into t3 values (17.987);
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(ceiling(col1) as signed integer) from t1 order by col1;
+cast(ceiling(col1) as signed integer)
+6
+14
+select * from t1 order by col1;
+col1
+5.1230
+13.3450
+select * from t2 order by col1;
+col1
+5.1230
+13.3450
+17.9870
+select * from t3 order by col1;
+col1
+5.1230
+13.3450
+17.9870
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+update t1 set col1=15.654 where col1=5.1230;
+update t2 set col1=15.654 where col1=5.1230;
+update t3 set col1=15.654 where col1=5.1230;
+update t4 set col1=15.654 where col1=5.1230;
+update t5 set col1=15.654 where col1=5.1230;
+update t6 set col1=15.654 where col1=5.1230;
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Alter tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(cast(ceiling(col1) as signed integer))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(cast(ceiling(col1) as signed integer))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(cast(ceiling(col1) as signed integer));
+alter table t44
+partition by range(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` float(7,4) DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(ceiling(col1) as signed integer)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+delete from t1 where col1=13.345;
+delete from t2 where col1=13.345;
+delete from t3 where col1=13.345;
+delete from t4 where col1=13.345;
+delete from t5 where col1=13.345;
+delete from t6 where col1=13.345;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t1 values (13.345);
+insert into t2 values (13.345);
+insert into t3 values (13.345);
+insert into t4 values (60,13.345);
+insert into t5 values (60,13.345);
+insert into t6 values (60,13.345);
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t6 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+60 13.3450
+select * from t5 order by colint;
+colint col1
+60 13.3450
+select * from t6 order by colint;
+colint col1
+60 13.3450
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+delete from t11 where col1=13.345;
+delete from t22 where col1=13.345;
+delete from t33 where col1=13.345;
+delete from t44 where col1=13.345;
+delete from t55 where col1=13.345;
+delete from t66 where col1=13.345;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t11 values (13.345);
+insert into t22 values (13.345);
+insert into t33 values (13.345);
+insert into t44 values (60,13.345);
+insert into t55 values (60,13.345);
+insert into t66 values (60,13.345);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t66 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+60 13.3450
+select * from t55 order by colint;
+colint col1
+60 13.3450
+select * from t66 order by colint;
+colint col1
+60 13.3450
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- cast(floor(col1) as signed) in partition with coltype float(7,4)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+create table t1 (col1 float(7,4)) engine='NDB'
+partition by range(cast(floor(col1) as signed))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 float(7,4)) engine='NDB'
+partition by list(cast(floor(col1) as signed))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 float(7,4)) engine='NDB'
+partition by hash(cast(floor(col1) as signed));
+create table t4 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 float(7,4)) engine='NDB'
+partition by list(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+insert into t1 values (5.1230);
+insert into t1 values (13.345);
+insert into t2 values (5.1230);
+insert into t2 values (13.345);
+insert into t2 values (17.987);
+insert into t3 values (5.1230);
+insert into t3 values (13.345);
+insert into t3 values (17.987);
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(floor(col1) as signed) from t1 order by col1;
+cast(floor(col1) as signed)
+5
+13
+select * from t1 order by col1;
+col1
+5.1230
+13.3450
+select * from t2 order by col1;
+col1
+5.1230
+13.3450
+17.9870
+select * from t3 order by col1;
+col1
+5.1230
+13.3450
+17.9870
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+update t1 set col1=15.654 where col1=5.1230;
+update t2 set col1=15.654 where col1=5.1230;
+update t3 set col1=15.654 where col1=5.1230;
+update t4 set col1=15.654 where col1=5.1230;
+update t5 set col1=15.654 where col1=5.1230;
+update t6 set col1=15.654 where col1=5.1230;
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Alter tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(cast(floor(col1) as signed))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(cast(floor(col1) as signed))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(cast(floor(col1) as signed));
+alter table t44
+partition by range(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` float(7,4) DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(floor(col1) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+delete from t1 where col1=13.345;
+delete from t2 where col1=13.345;
+delete from t3 where col1=13.345;
+delete from t4 where col1=13.345;
+delete from t5 where col1=13.345;
+delete from t6 where col1=13.345;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t1 values (13.345);
+insert into t2 values (13.345);
+insert into t3 values (13.345);
+insert into t4 values (60,13.345);
+insert into t5 values (60,13.345);
+insert into t6 values (60,13.345);
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t5 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t6 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint col1
+60 13.3450
+select * from t5 order by colint;
+colint col1
+60 13.3450
+select * from t6 order by colint;
+colint col1
+60 13.3450
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+delete from t11 where col1=13.345;
+delete from t22 where col1=13.345;
+delete from t33 where col1=13.345;
+delete from t44 where col1=13.345;
+delete from t55 where col1=13.345;
+delete from t66 where col1=13.345;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+insert into t11 values (13.345);
+insert into t22 values (13.345);
+insert into t33 values (13.345);
+insert into t44 values (60,13.345);
+insert into t55 values (60,13.345);
+insert into t66 values (60,13.345);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t55 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+select * from t66 order by colint;
+colint col1
+1 15.6540
+3 17.9870
+4 15.6540
+60 13.3450
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint col1
+60 13.3450
+select * from t55 order by colint;
+colint col1
+60 13.3450
+select * from t66 order by colint;
+colint col1
+60 13.3450
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- cast(mod(col1,10) as signed) in partition with coltype float(7,4)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+create table t1 (col1 float(7,4)) engine='NDB'
+partition by range(cast(mod(col1,10) as signed))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 float(7,4)) engine='NDB'
+partition by list(cast(mod(col1,10) as signed))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 float(7,4)) engine='NDB'
+partition by hash(cast(mod(col1,10) as signed));
+create table t4 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 float(7,4)) engine='NDB'
+partition by list(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+insert into t1 values (5.0000);
+insert into t1 values (19);
+insert into t2 values (5.0000);
+insert into t2 values (19);
+insert into t2 values (17);
+insert into t3 values (5.0000);
+insert into t3 values (19);
+insert into t3 values (17);
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(mod(col1,10) as signed) from t1 order by col1;
+cast(mod(col1,10) as signed)
+5
+9
+select * from t1 order by col1;
+col1
+5.0000
+19.0000
+select * from t2 order by col1;
+col1
+5.0000
+17.0000
+19.0000
+select * from t3 order by col1;
+col1
+5.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+update t1 set col1=15 where col1=5.0000;
+update t2 set col1=15 where col1=5.0000;
+update t3 set col1=15 where col1=5.0000;
+update t4 set col1=15 where col1=5.0000;
+update t5 set col1=15 where col1=5.0000;
+update t6 set col1=15 where col1=5.0000;
+select * from t1 order by col1;
+col1
+15.0000
+19.0000
+select * from t2 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t6 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Alter tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(cast(mod(col1,10) as signed))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(cast(mod(col1,10) as signed))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(cast(mod(col1,10) as signed));
+alter table t44
+partition by range(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+select * from t22 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t44 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` float(7,4) DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(mod(col1,10) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+delete from t1 where col1=19;
+delete from t2 where col1=19;
+delete from t3 where col1=19;
+delete from t4 where col1=19;
+delete from t5 where col1=19;
+delete from t6 where col1=19;
+select * from t1 order by col1;
+col1
+15.0000
+select * from t2 order by col1;
+col1
+15.0000
+17.0000
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+insert into t1 values (19);
+insert into t2 values (19);
+insert into t3 values (19);
+insert into t4 values (60,19);
+insert into t5 values (60,19);
+insert into t6 values (60,19);
+select * from t1 order by col1;
+col1
+15.0000
+19.0000
+select * from t2 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t5 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t6 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint col1
+60 19.0000
+select * from t5 order by colint;
+colint col1
+60 19.0000
+select * from t6 order by colint;
+colint col1
+60 19.0000
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+delete from t11 where col1=19;
+delete from t22 where col1=19;
+delete from t33 where col1=19;
+delete from t44 where col1=19;
+delete from t55 where col1=19;
+delete from t66 where col1=19;
+select * from t11 order by col1;
+col1
+15.0000
+select * from t22 order by col1;
+col1
+15.0000
+17.0000
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+select * from t44 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+insert into t11 values (19);
+insert into t22 values (19);
+insert into t33 values (19);
+insert into t44 values (60,19);
+insert into t55 values (60,19);
+insert into t66 values (60,19);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+select * from t22 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t44 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t55 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+select * from t66 order by colint;
+colint col1
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+60 19.0000
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t44 order by colint;
+colint col1
+60 19.0000
+select * from t55 order by colint;
+colint col1
+60 19.0000
+select * from t66 order by colint;
+colint col1
+60 19.0000
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- ord(col1) in partition with coltype char(3)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with ord(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 char(3)) engine='NDB'
+partition by range(ord(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 char(3)) engine='NDB'
+partition by list(ord(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 char(3)) engine='NDB'
+partition by hash(ord(col1));
+create table t4 (colint int, col1 char(3)) engine='NDB'
+partition by range(colint)
+subpartition by hash(ord(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 char(3)) engine='NDB'
+partition by list(colint)
+subpartition by hash(ord(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 char(3)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with ord(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('1');
+insert into t1 values ('9');
+insert into t2 values ('1');
+insert into t2 values ('9');
+insert into t2 values ('3');
+insert into t3 values ('1');
+insert into t3 values ('9');
+insert into t3 values ('3');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
+select ord(col1) from t1 order by col1;
+ord(col1)
+49
+57
+select * from t1 order by col1;
+col1
+1
+9
+select * from t2 order by col1;
+col1
+1
+3
+9
+select * from t3 order by col1;
+col1
+1
+3
+9
+select * from t4 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t6 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+update t1 set col1='8' where col1='1';
+update t2 set col1='8' where col1='1';
+update t3 set col1='8' where col1='1';
+update t4 set col1='8' where col1='1';
+update t5 set col1='8' where col1='1';
+update t6 set col1='8' where col1='1';
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t6 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+-------------------------------------------------------------------------
+--- Alter tables with ord(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(ord(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(ord(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(ord(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(ord(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(ord(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t55
+partition by list(colint)
+subpartition by hash(ord(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(3) DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ord(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 8
+2 9
+3 3
+4 8
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ord(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='9';
+delete from t2 where col1='9';
+delete from t3 where col1='9';
+delete from t4 where col1='9';
+delete from t5 where col1='9';
+delete from t6 where col1='9';
+select * from t1 order by col1;
+col1
+8
+select * from t2 order by col1;
+col1
+3
+8
+select * from t3 order by col1;
+col1
+3
+8
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t1 values ('9');
+insert into t2 values ('9');
+insert into t3 values ('9');
+insert into t4 values (60,'9');
+insert into t5 values (60,'9');
+insert into t6 values (60,'9');
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t5 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t6 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint col1
+60 9
+select * from t5 order by colint;
+colint col1
+60 9
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with ord(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='9';
+delete from t22 where col1='9';
+delete from t33 where col1='9';
+delete from t44 where col1='9';
+delete from t55 where col1='9';
+delete from t66 where col1='9';
+select * from t11 order by col1;
+col1
+8
+select * from t22 order by col1;
+col1
+3
+8
+select * from t33 order by col1;
+col1
+3
+8
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+insert into t11 values ('9');
+insert into t22 values ('9');
+insert into t33 values ('9');
+insert into t44 values (60,'9');
+insert into t55 values (60,'9');
+insert into t66 values (60,'9');
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t55 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+select * from t66 order by colint;
+colint col1
+1 8
+3 3
+4 8
+60 9
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint col1
+60 9
+select * from t55 order by colint;
+colint col1
+60 9
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- day(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with day(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(day(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(day(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(day(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(day(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(day(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with day(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-02-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-02-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-02-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-01-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select day(col1) from t1 order by col1;
+day(col1)
+17
+3
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-03
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-02-03';
+update t2 set col1='2006-02-05' where col1='2006-02-03';
+update t3 set col1='2006-02-05' where col1='2006-02-03';
+update t4 set col1='2006-02-05' where col1='2006-02-03';
+update t5 set col1='2006-02-05' where col1='2006-02-03';
+update t6 set col1='2006-02-05' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with day(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(day(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(day(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(day(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(day(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(day(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(day(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with day(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+60 2006-01-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with day(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+60 2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- dayofmonth(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(dayofmonth(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(dayofmonth(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(dayofmonth(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-02-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-02-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-02-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-01-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofmonth(col1) from t1 order by col1;
+dayofmonth(col1)
+17
+3
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-03
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-02-03';
+update t2 set col1='2006-02-05' where col1='2006-02-03';
+update t3 set col1='2006-02-05' where col1='2006-02-03';
+update t4 set col1='2006-02-05' where col1='2006-02-03';
+update t5 set col1='2006-02-05' where col1='2006-02-03';
+update t6 set col1='2006-02-05' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(dayofmonth(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(dayofmonth(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(dayofmonth(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+60 2006-01-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-05
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+60 2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- dayofweek(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with dayofweek(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(dayofweek(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(dayofweek(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(dayofweek(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with dayofweek(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-02-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-02-17');
+insert into t3 values ('2006-01-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofweek(col1) from t1 order by col1;
+dayofweek(col1)
+3
+6
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-01-25
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-01-25
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with dayofweek(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(dayofweek(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(dayofweek(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(dayofweek(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofweek(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-02-17';
+delete from t2 where col1='2006-02-17';
+delete from t3 where col1='2006-02-17';
+delete from t4 where col1='2006-02-17';
+delete from t5 where col1='2006-02-17';
+delete from t6 where col1='2006-02-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-02-17');
+insert into t3 values ('2006-02-17');
+insert into t4 values (60,'2006-02-17');
+insert into t5 values (60,'2006-02-17');
+insert into t6 values (60,'2006-02-17');
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+60 2006-02-17
+select * from t5 order by colint;
+colint col1
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofweek(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-02-17';
+delete from t22 where col1='2006-02-17';
+delete from t33 where col1='2006-02-17';
+delete from t44 where col1='2006-02-17';
+delete from t55 where col1='2006-02-17';
+delete from t66 where col1='2006-02-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-02-17');
+insert into t22 values ('2006-02-17');
+insert into t33 values ('2006-02-17');
+insert into t44 values (60,'2006-02-17');
+insert into t55 values (60,'2006-02-17');
+insert into t66 values (60,'2006-02-17');
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- dayofyear(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with dayofyear(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(dayofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(dayofyear(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(dayofyear(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with dayofyear(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-02-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-02-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofyear(col1) from t1 order by col1;
+dayofyear(col1)
+3
+17
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-01-17
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-01-17
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with dayofyear(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(dayofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(dayofyear(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(dayofyear(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- dayofyear(col1) in partition with coltype char(30)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with dayofyear(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 char(30)) engine='NDB'
+partition by range(dayofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 char(30)) engine='NDB'
+partition by list(dayofyear(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 char(30)) engine='NDB'
+partition by hash(dayofyear(col1));
+create table t4 (colint int, col1 char(30)) engine='NDB'
+partition by range(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 char(30)) engine='NDB'
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 char(30)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with dayofyear(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-02-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-02-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofyear(col1) from t1 order by col1;
+dayofyear(col1)
+3
+17
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-01-17
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-01-17
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with dayofyear(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(dayofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(dayofyear(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(dayofyear(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(30) DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- extract(month from col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with extract(month from col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(extract(month from col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(extract(month from col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(extract(month from col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(extract(month from col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(extract(month from col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with extract(month from col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-02-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-02-17');
+insert into t3 values ('2006-01-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select extract(month from col1) from t1 order by col1;
+extract(month from col1)
+1
+2
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-01-25
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-01-25
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with extract(month from col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(extract(month from col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(extract(month from col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(extract(month from col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(extract(month from col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(extract(month from col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+alter table t55
+partition by list(colint)
+subpartition by hash(extract(month from col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with extract(month from col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-02-17';
+delete from t2 where col1='2006-02-17';
+delete from t3 where col1='2006-02-17';
+delete from t4 where col1='2006-02-17';
+delete from t5 where col1='2006-02-17';
+delete from t6 where col1='2006-02-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-02-17');
+insert into t3 values ('2006-02-17');
+insert into t4 values (60,'2006-02-17');
+insert into t5 values (60,'2006-02-17');
+insert into t6 values (60,'2006-02-17');
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint col1
+60 2006-02-17
+select * from t5 order by colint;
+colint col1
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with extract(month from col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-02-17';
+delete from t22 where col1='2006-02-17';
+delete from t33 where col1='2006-02-17';
+delete from t44 where col1='2006-02-17';
+delete from t55 where col1='2006-02-17';
+delete from t66 where col1='2006-02-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-02-17');
+insert into t22 values ('2006-02-17');
+insert into t33 values ('2006-02-17');
+insert into t44 values (60,'2006-02-17');
+insert into t55 values (60,'2006-02-17');
+insert into t66 values (60,'2006-02-17');
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint col1
+60 2006-02-17
+select * from t55 order by colint;
+colint col1
+60 2006-02-17
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- hour(col1) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with hour(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(hour(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(hour(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(hour(col1));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(hour(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(hour(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with hour(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09');
+insert into t1 values ('14:30');
+insert into t2 values ('09:09');
+insert into t2 values ('14:30');
+insert into t2 values ('21:59');
+insert into t3 values ('09:09');
+insert into t3 values ('14:30');
+insert into t3 values ('21:59');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select hour(col1) from t1 order by col1;
+hour(col1)
+9
+14
+select * from t1 order by col1;
+col1
+09:09:00
+14:30:00
+select * from t2 order by col1;
+col1
+09:09:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+09:09:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:30' where col1='09:09';
+update t2 set col1='10:30' where col1='09:09';
+update t3 set col1='10:30' where col1='09:09';
+update t4 set col1='10:30' where col1='09:09';
+update t5 set col1='10:30' where col1='09:09';
+update t6 set col1='10:30' where col1='09:09';
+select * from t1 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Alter tables with hour(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(hour(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(hour(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(hour(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(hour(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(hour(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t22 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+alter table t55
+partition by list(colint)
+subpartition by hash(hour(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with hour(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30';
+delete from t2 where col1='14:30';
+delete from t3 where col1='14:30';
+delete from t4 where col1='14:30';
+delete from t5 where col1='14:30';
+delete from t6 where col1='14:30';
+select * from t1 order by col1;
+col1
+10:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30');
+insert into t2 values ('14:30');
+insert into t3 values ('14:30');
+insert into t4 values (60,'14:30');
+insert into t5 values (60,'14:30');
+insert into t6 values (60,'14:30');
+select * from t1 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint col1
+60 14:30:00
+select * from t5 order by colint;
+colint col1
+60 14:30:00
+select * from t6 order by colint;
+colint col1
+60 14:30:00
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with hour(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30';
+delete from t22 where col1='14:30';
+delete from t33 where col1='14:30';
+delete from t44 where col1='14:30';
+delete from t55 where col1='14:30';
+delete from t66 where col1='14:30';
+select * from t11 order by col1;
+col1
+10:30:00
+select * from t22 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30');
+insert into t22 values ('14:30');
+insert into t33 values ('14:30');
+insert into t44 values (60,'14:30');
+insert into t55 values (60,'14:30');
+insert into t66 values (60,'14:30');
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t22 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:00
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+14:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t44 order by colint;
+colint col1
+60 14:30:00
+select * from t55 order by colint;
+colint col1
+60 14:30:00
+select * from t66 order by colint;
+colint col1
+60 14:30:00
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- microsecond(col1) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with microsecond(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(microsecond(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(microsecond(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(microsecond(col1));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(microsecond(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(microsecond(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with microsecond(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:15.000002');
+insert into t1 values ('04:30:01.000018');
+insert into t2 values ('09:09:15.000002');
+insert into t2 values ('04:30:01.000018');
+insert into t2 values ('00:59:22.000024');
+insert into t3 values ('09:09:15.000002');
+insert into t3 values ('04:30:01.000018');
+insert into t3 values ('00:59:22.000024');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select microsecond(col1) from t1 order by col1;
+microsecond(col1)
+0
+0
+select * from t1 order by col1;
+col1
+04:30:01
+09:09:15
+select * from t2 order by col1;
+col1
+00:59:22
+04:30:01
+09:09:15
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+09:09:15
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t2 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t3 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t4 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t5 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t6 set col1='05:30:34.000037' where col1='09:09:15.000002';
+select * from t1 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t2 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t4 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Alter tables with microsecond(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(microsecond(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(microsecond(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(microsecond(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(microsecond(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(microsecond(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t22 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t33 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+alter table t55
+partition by list(colint)
+subpartition by hash(microsecond(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with microsecond(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='04:30:01.000018';
+delete from t2 where col1='04:30:01.000018';
+delete from t3 where col1='04:30:01.000018';
+delete from t4 where col1='04:30:01.000018';
+delete from t5 where col1='04:30:01.000018';
+delete from t6 where col1='04:30:01.000018';
+select * from t1 order by col1;
+col1
+05:30:34
+select * from t2 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t3 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t4 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+insert into t1 values ('04:30:01.000018');
+insert into t2 values ('04:30:01.000018');
+insert into t3 values ('04:30:01.000018');
+insert into t4 values (60,'04:30:01.000018');
+insert into t5 values (60,'04:30:01.000018');
+insert into t6 values (60,'04:30:01.000018');
+select * from t1 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t2 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t4 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t5 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t6 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t4 order by colint;
+colint col1
+60 04:30:01
+select * from t5 order by colint;
+colint col1
+60 04:30:01
+select * from t6 order by colint;
+colint col1
+60 04:30:01
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with microsecond(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='04:30:01.000018';
+delete from t22 where col1='04:30:01.000018';
+delete from t33 where col1='04:30:01.000018';
+delete from t44 where col1='04:30:01.000018';
+delete from t55 where col1='04:30:01.000018';
+delete from t66 where col1='04:30:01.000018';
+select * from t11 order by col1;
+col1
+05:30:34
+select * from t22 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t33 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t44 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+insert into t11 values ('04:30:01.000018');
+insert into t22 values ('04:30:01.000018');
+insert into t33 values ('04:30:01.000018');
+insert into t44 values (60,'04:30:01.000018');
+insert into t55 values (60,'04:30:01.000018');
+insert into t66 values (60,'04:30:01.000018');
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t22 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t33 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t55 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+select * from t66 order by colint;
+colint col1
+1 05:30:34
+3 00:59:22
+4 05:30:34
+60 04:30:01
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint col1
+60 04:30:01
+select * from t55 order by colint;
+colint col1
+60 04:30:01
+select * from t66 order by colint;
+colint col1
+60 04:30:01
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- minute(col1) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with minute(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(minute(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(minute(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(minute(col1));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(minute(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(minute(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with minute(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:15');
+insert into t1 values ('14:30:45');
+insert into t2 values ('09:09:15');
+insert into t2 values ('14:30:45');
+insert into t2 values ('21:59:22');
+insert into t3 values ('09:09:15');
+insert into t3 values ('14:30:45');
+insert into t3 values ('21:59:22');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select minute(col1) from t1 order by col1;
+minute(col1)
+9
+30
+select * from t1 order by col1;
+col1
+09:09:15
+14:30:45
+select * from t2 order by col1;
+col1
+09:09:15
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+09:09:15
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:24:23' where col1='09:09:15';
+update t2 set col1='10:24:23' where col1='09:09:15';
+update t3 set col1='10:24:23' where col1='09:09:15';
+update t4 set col1='10:24:23' where col1='09:09:15';
+update t5 set col1='10:24:23' where col1='09:09:15';
+update t6 set col1='10:24:23' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Alter tables with minute(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(minute(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(minute(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(minute(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(minute(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(minute(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t22 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(minute(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with minute(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:45';
+delete from t2 where col1='14:30:45';
+delete from t3 where col1='14:30:45';
+delete from t4 where col1='14:30:45';
+delete from t5 where col1='14:30:45';
+delete from t6 where col1='14:30:45';
+select * from t1 order by col1;
+col1
+10:24:23
+select * from t2 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30:45');
+insert into t2 values ('14:30:45');
+insert into t3 values ('14:30:45');
+insert into t4 values (60,'14:30:45');
+insert into t5 values (60,'14:30:45');
+insert into t6 values (60,'14:30:45');
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+60 14:30:45
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with minute(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:45';
+delete from t22 where col1='14:30:45';
+delete from t33 where col1='14:30:45';
+delete from t44 where col1='14:30:45';
+delete from t55 where col1='14:30:45';
+delete from t66 where col1='14:30:45';
+select * from t11 order by col1;
+col1
+10:24:23
+select * from t22 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30:45');
+insert into t22 values ('14:30:45');
+insert into t33 values ('14:30:45');
+insert into t44 values (60,'14:30:45');
+insert into t55 values (60,'14:30:45');
+insert into t66 values (60,'14:30:45');
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t22 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+1 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t22 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+60 14:30:45
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- second(col1) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with second(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(second(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(second(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(second(col1));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with second(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:09');
+insert into t1 values ('14:30:20');
+insert into t2 values ('09:09:09');
+insert into t2 values ('14:30:20');
+insert into t2 values ('21:59:22');
+insert into t3 values ('09:09:09');
+insert into t3 values ('14:30:20');
+insert into t3 values ('21:59:22');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select second(col1) from t1 order by col1;
+second(col1)
+9
+20
+select * from t1 order by col1;
+col1
+09:09:09
+14:30:20
+select * from t2 order by col1;
+col1
+09:09:09
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+09:09:09
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:22:33' where col1='09:09:09';
+update t2 set col1='10:22:33' where col1='09:09:09';
+update t3 set col1='10:22:33' where col1='09:09:09';
+update t4 set col1='10:22:33' where col1='09:09:09';
+update t5 set col1='10:22:33' where col1='09:09:09';
+update t6 set col1='10:22:33' where col1='09:09:09';
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Alter tables with second(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(second(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(second(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(second(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:20';
+delete from t2 where col1='14:30:20';
+delete from t3 where col1='14:30:20';
+delete from t4 where col1='14:30:20';
+delete from t5 where col1='14:30:20';
+delete from t6 where col1='14:30:20';
+select * from t1 order by col1;
+col1
+10:22:33
+select * from t2 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30:20');
+insert into t2 values ('14:30:20');
+insert into t3 values ('14:30:20');
+insert into t4 values (60,'14:30:20');
+insert into t5 values (60,'14:30:20');
+insert into t6 values (60,'14:30:20');
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+60 14:30:20
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:20';
+delete from t22 where col1='14:30:20';
+delete from t33 where col1='14:30:20';
+delete from t44 where col1='14:30:20';
+delete from t55 where col1='14:30:20';
+delete from t66 where col1='14:30:20';
+select * from t11 order by col1;
+col1
+10:22:33
+select * from t22 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30:20');
+insert into t22 values ('14:30:20');
+insert into t33 values ('14:30:20');
+insert into t44 values (60,'14:30:20');
+insert into t55 values (60,'14:30:20');
+insert into t66 values (60,'14:30:20');
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:20
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+60 14:30:20
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- second(col1) in partition with coltype char(30)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with second(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 char(30)) engine='NDB'
+partition by range(second(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 char(30)) engine='NDB'
+partition by list(second(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 char(30)) engine='NDB'
+partition by hash(second(col1));
+create table t4 (colint int, col1 char(30)) engine='NDB'
+partition by range(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 char(30)) engine='NDB'
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 char(30)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with second(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:09');
+insert into t1 values ('14:30:20');
+insert into t2 values ('09:09:09');
+insert into t2 values ('14:30:20');
+insert into t2 values ('21:59:22');
+insert into t3 values ('09:09:09');
+insert into t3 values ('14:30:20');
+insert into t3 values ('21:59:22');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select second(col1) from t1 order by col1;
+second(col1)
+9
+20
+select * from t1 order by col1;
+col1
+09:09:09
+14:30:20
+select * from t2 order by col1;
+col1
+09:09:09
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+09:09:09
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t6 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+update t1 set col1='10:22:33' where col1='09:09:09';
+update t2 set col1='10:22:33' where col1='09:09:09';
+update t3 set col1='10:22:33' where col1='09:09:09';
+update t4 set col1='10:22:33' where col1='09:09:09';
+update t5 set col1='10:22:33' where col1='09:09:09';
+update t6 set col1='10:22:33' where col1='09:09:09';
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t6 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+-------------------------------------------------------------------------
+--- Alter tables with second(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(second(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(second(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(second(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` char(30) DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:20';
+delete from t2 where col1='14:30:20';
+delete from t3 where col1='14:30:20';
+delete from t4 where col1='14:30:20';
+delete from t5 where col1='14:30:20';
+delete from t6 where col1='14:30:20';
+select * from t1 order by col1;
+col1
+10:22:33
+select * from t2 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+insert into t1 values ('14:30:20');
+insert into t2 values ('14:30:20');
+insert into t3 values ('14:30:20');
+insert into t4 values (60,'14:30:20');
+insert into t5 values (60,'14:30:20');
+insert into t6 values (60,'14:30:20');
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:20
+select * from t5 order by colint;
+colint col1
+60 14:30:20
+select * from t6 order by colint;
+colint col1
+60 14:30:20
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:20';
+delete from t22 where col1='14:30:20';
+delete from t33 where col1='14:30:20';
+delete from t44 where col1='14:30:20';
+delete from t55 where col1='14:30:20';
+delete from t66 where col1='14:30:20';
+select * from t11 order by col1;
+col1
+10:22:33
+select * from t22 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+insert into t11 values ('14:30:20');
+insert into t22 values ('14:30:20');
+insert into t33 values ('14:30:20');
+insert into t44 values (60,'14:30:20');
+insert into t55 values (60,'14:30:20');
+insert into t66 values (60,'14:30:20');
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
+60 14:30:20
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:20
+select * from t55 order by colint;
+colint col1
+60 14:30:20
+select * from t66 order by colint;
+colint col1
+60 14:30:20
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- month(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with month(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(month(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(month(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(month(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(month(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(month(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with month(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-12-17');
+insert into t2 values ('2006-05-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-12-17');
+insert into t3 values ('2006-05-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select month(col1) from t1 order by col1;
+month(col1)
+1
+12
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-05-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-05-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-11-06' where col1='2006-01-03';
+update t2 set col1='2006-11-06' where col1='2006-01-03';
+update t3 set col1='2006-11-06' where col1='2006-01-03';
+update t4 set col1='2006-11-06' where col1='2006-01-03';
+update t5 set col1='2006-11-06' where col1='2006-01-03';
+update t6 set col1='2006-11-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with month(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(month(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(month(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(month(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(month(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(month(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+alter table t55
+partition by list(colint)
+subpartition by hash(month(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with month(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-12-17';
+delete from t2 where col1='2006-12-17';
+delete from t3 where col1='2006-12-17';
+delete from t4 where col1='2006-12-17';
+delete from t5 where col1='2006-12-17';
+delete from t6 where col1='2006-12-17';
+select * from t1 order by col1;
+col1
+2006-11-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-12-17');
+insert into t3 values ('2006-12-17');
+insert into t4 values (60,'2006-12-17');
+insert into t5 values (60,'2006-12-17');
+insert into t6 values (60,'2006-12-17');
+select * from t1 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint col1
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+60 2006-12-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with month(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-12-17';
+delete from t22 where col1='2006-12-17';
+delete from t33 where col1='2006-12-17';
+delete from t44 where col1='2006-12-17';
+delete from t55 where col1='2006-12-17';
+delete from t66 where col1='2006-12-17';
+select * from t11 order by col1;
+col1
+2006-11-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-12-17');
+insert into t22 values ('2006-12-17');
+insert into t33 values ('2006-12-17');
+insert into t44 values (60,'2006-12-17');
+insert into t55 values (60,'2006-12-17');
+insert into t66 values (60,'2006-12-17');
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint col1
+60 2006-12-17
+select * from t55 order by colint;
+colint col1
+60 2006-12-17
+select * from t66 order by colint;
+colint col1
+60 2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- quarter(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with quarter(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(quarter(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(quarter(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(quarter(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(quarter(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(quarter(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with quarter(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-12-17');
+insert into t2 values ('2006-09-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-12-17');
+insert into t3 values ('2006-09-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select quarter(col1) from t1 order by col1;
+quarter(col1)
+1
+4
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-09-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-07-30' where col1='2006-01-03';
+update t2 set col1='2006-07-30' where col1='2006-01-03';
+update t3 set col1='2006-07-30' where col1='2006-01-03';
+update t4 set col1='2006-07-30' where col1='2006-01-03';
+update t5 set col1='2006-07-30' where col1='2006-01-03';
+update t6 set col1='2006-07-30' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with quarter(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(quarter(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(quarter(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(quarter(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(quarter(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(quarter(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-07-30
+2006-12-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-07-30
+2006-12-17
+alter table t55
+partition by list(colint)
+subpartition by hash(quarter(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with quarter(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-12-17';
+delete from t2 where col1='2006-12-17';
+delete from t3 where col1='2006-12-17';
+delete from t4 where col1='2006-12-17';
+delete from t5 where col1='2006-12-17';
+delete from t6 where col1='2006-12-17';
+select * from t1 order by col1;
+col1
+2006-07-30
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-12-17');
+insert into t3 values ('2006-12-17');
+insert into t4 values (60,'2006-12-17');
+insert into t5 values (60,'2006-12-17');
+insert into t6 values (60,'2006-12-17');
+select * from t1 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
+colint col1
+60 2006-12-17
+select * from t5 order by colint;
+colint col1
+60 2006-12-17
+select * from t6 order by colint;
+colint col1
+4 2006-02-05
+60 2006-12-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with quarter(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-12-17';
+delete from t22 where col1='2006-12-17';
+delete from t33 where col1='2006-12-17';
+delete from t44 where col1='2006-12-17';
+delete from t55 where col1='2006-12-17';
+delete from t66 where col1='2006-12-17';
+select * from t11 order by col1;
+col1
+2006-07-30
+select * from t22 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-12-17');
+insert into t22 values ('2006-12-17');
+insert into t33 values ('2006-12-17');
+insert into t44 values (60,'2006-12-17');
+insert into t55 values (60,'2006-12-17');
+insert into t66 values (60,'2006-12-17');
+select * from t11 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-12-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t44 order by colint;
+colint col1
+60 2006-12-17
+select * from t55 order by colint;
+colint col1
+60 2006-12-17
+select * from t66 order by colint;
+colint col1
+4 2006-02-05
+60 2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- time_to_sec(col1)-(time_to_sec(col1)-20) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(time_to_sec(col1)-(time_to_sec(col1)-20))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(time_to_sec(col1)-(time_to_sec(col1)-20))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:15');
+insert into t1 values ('14:30:45');
+insert into t2 values ('09:09:15');
+insert into t2 values ('14:30:45');
+insert into t2 values ('21:59:22');
+insert into t3 values ('09:09:15');
+insert into t3 values ('14:30:45');
+insert into t3 values ('21:59:22');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
+time_to_sec(col1)-(time_to_sec(col1)-20)
+20
+20
+select * from t1 order by col1;
+col1
+09:09:15
+14:30:45
+select * from t2 order by col1;
+col1
+09:09:15
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+09:09:15
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+update t1 set col1='10:33:11' where col1='09:09:15';
+update t2 set col1='10:33:11' where col1='09:09:15';
+update t3 set col1='10:33:11' where col1='09:09:15';
+update t4 set col1='10:33:11' where col1='09:09:15';
+update t5 set col1='10:33:11' where col1='09:09:15';
+update t6 set col1='10:33:11' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(time_to_sec(col1)-(time_to_sec(col1)-20))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(time_to_sec(col1)-(time_to_sec(col1)-20))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
+alter table t44
+partition by range(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` time DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:45';
+delete from t2 where col1='14:30:45';
+delete from t3 where col1='14:30:45';
+delete from t4 where col1='14:30:45';
+delete from t5 where col1='14:30:45';
+delete from t6 where col1='14:30:45';
+select * from t1 order by col1;
+col1
+10:33:11
+select * from t2 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t1 values ('14:30:45');
+insert into t2 values ('14:30:45');
+insert into t3 values ('14:30:45');
+insert into t4 values (60,'14:30:45');
+insert into t5 values (60,'14:30:45');
+insert into t6 values (60,'14:30:45');
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+60 14:30:45
+select * from t5 order by colint;
+colint col1
+60 14:30:45
+select * from t6 order by colint;
+colint col1
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:45';
+delete from t22 where col1='14:30:45';
+delete from t33 where col1='14:30:45';
+delete from t44 where col1='14:30:45';
+delete from t55 where col1='14:30:45';
+delete from t66 where col1='14:30:45';
+select * from t11 order by col1;
+col1
+10:33:11
+select * from t22 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+insert into t11 values ('14:30:45');
+insert into t22 values ('14:30:45');
+insert into t33 values ('14:30:45');
+insert into t44 values (60,'14:30:45');
+insert into t55 values (60,'14:30:45');
+insert into t66 values (60,'14:30:45');
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+60 14:30:45
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+60 14:30:45
+select * from t55 order by colint;
+colint col1
+60 14:30:45
+select * from t66 order by colint;
+colint col1
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- to_days(col1)-to_days('2006-01-01') in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(to_days(col1)-to_days('2006-01-01'))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(to_days(col1)-to_days('2006-01-01'))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(to_days(col1)-to_days('2006-01-01'));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+insert into t1 values ('2006-02-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-02-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-02-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-01-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
+to_days(col1)-to_days('2006-01-01')
+16
+33
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-03
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-06' where col1='2006-02-03';
+update t2 set col1='2006-02-06' where col1='2006-02-03';
+update t3 set col1='2006-02-06' where col1='2006-02-03';
+update t4 set col1='2006-02-06' where col1='2006-02-03';
+update t5 set col1='2006-02-06' where col1='2006-02-03';
+update t6 set col1='2006-02-06' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(to_days(col1)-to_days('2006-01-01'))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(to_days(col1)-to_days('2006-01-01'))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(to_days(col1)-to_days('2006-01-01'));
+alter table t44
+partition by range(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+alter table t55
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+60 2006-01-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+60 2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- weekday(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with weekday(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(weekday(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(weekday(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(weekday(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(weekday(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(weekday(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with weekday(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-12-03');
+insert into t1 values ('2006-11-17');
+insert into t2 values ('2006-12-03');
+insert into t2 values ('2006-11-17');
+insert into t2 values ('2006-05-25');
+insert into t3 values ('2006-12-03');
+insert into t3 values ('2006-11-17');
+insert into t3 values ('2006-05-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select weekday(col1) from t1 order by col1;
+weekday(col1)
+4
+6
+select * from t1 order by col1;
+col1
+2006-11-17
+2006-12-03
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-17
+2006-12-03
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-17
+2006-12-03
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-06' where col1='2006-12-03';
+update t2 set col1='2006-02-06' where col1='2006-12-03';
+update t3 set col1='2006-02-06' where col1='2006-12-03';
+update t4 set col1='2006-02-06' where col1='2006-12-03';
+update t5 set col1='2006-02-06' where col1='2006-12-03';
+update t6 set col1='2006-02-06' where col1='2006-12-03';
+select * from t1 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with weekday(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(weekday(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(weekday(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(weekday(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(weekday(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(weekday(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+alter table t55
+partition by list(colint)
+subpartition by hash(weekday(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekday(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-11-17';
+delete from t2 where col1='2006-11-17';
+delete from t3 where col1='2006-11-17';
+delete from t4 where col1='2006-11-17';
+delete from t5 where col1='2006-11-17';
+delete from t6 where col1='2006-11-17';
+select * from t1 order by col1;
+col1
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-11-17');
+insert into t2 values ('2006-11-17');
+insert into t3 values ('2006-11-17');
+insert into t4 values (60,'2006-11-17');
+insert into t5 values (60,'2006-11-17');
+insert into t6 values (60,'2006-11-17');
+select * from t1 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+60 2006-11-17
+select * from t5 order by colint;
+colint col1
+60 2006-11-17
+select * from t6 order by colint;
+colint col1
+60 2006-11-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekday(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-11-17';
+delete from t22 where col1='2006-11-17';
+delete from t33 where col1='2006-11-17';
+delete from t44 where col1='2006-11-17';
+delete from t55 where col1='2006-11-17';
+delete from t66 where col1='2006-11-17';
+select * from t11 order by col1;
+col1
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-11-17');
+insert into t22 values ('2006-11-17');
+insert into t33 values ('2006-11-17');
+insert into t44 values (60,'2006-11-17');
+insert into t55 values (60,'2006-11-17');
+insert into t66 values (60,'2006-11-17');
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t44 order by colint;
+colint col1
+60 2006-11-17
+select * from t55 order by colint;
+colint col1
+60 2006-11-17
+select * from t66 order by colint;
+colint col1
+60 2006-11-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- weekofyear(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with weekofyear(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(weekofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(weekofyear(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(weekofyear(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with weekofyear(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-03-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-03-17');
+insert into t2 values ('2006-05-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-03-17');
+insert into t3 values ('2006-05-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select weekofyear(col1) from t1 order by col1;
+weekofyear(col1)
+1
+11
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-03-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-03-17
+2006-05-25
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-03-17
+2006-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-09-06' where col1='2006-01-03';
+update t2 set col1='2006-09-06' where col1='2006-01-03';
+update t3 set col1='2006-09-06' where col1='2006-01-03';
+update t4 set col1='2006-09-06' where col1='2006-01-03';
+update t5 set col1='2006-09-06' where col1='2006-01-03';
+update t6 set col1='2006-09-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with weekofyear(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(weekofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(weekofyear(col1))
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(weekofyear(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+alter table t55
+partition by list(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-03-17';
+delete from t2 where col1='2006-03-17';
+delete from t3 where col1='2006-03-17';
+delete from t4 where col1='2006-03-17';
+delete from t5 where col1='2006-03-17';
+delete from t6 where col1='2006-03-17';
+select * from t1 order by col1;
+col1
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-03-17');
+insert into t2 values ('2006-03-17');
+insert into t3 values ('2006-03-17');
+insert into t4 values (60,'2006-03-17');
+insert into t5 values (60,'2006-03-17');
+insert into t6 values (60,'2006-03-17');
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+60 2006-03-17
+select * from t5 order by colint;
+colint col1
+60 2006-03-17
+select * from t6 order by colint;
+colint col1
+60 2006-03-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-03-17';
+delete from t22 where col1='2006-03-17';
+delete from t33 where col1='2006-03-17';
+delete from t44 where col1='2006-03-17';
+delete from t55 where col1='2006-03-17';
+delete from t66 where col1='2006-03-17';
+select * from t11 order by col1;
+col1
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-03-17');
+insert into t22 values ('2006-03-17');
+insert into t33 values ('2006-03-17');
+insert into t44 values (60,'2006-03-17');
+insert into t55 values (60,'2006-03-17');
+insert into t66 values (60,'2006-03-17');
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-03-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+60 2006-03-17
+select * from t55 order by colint;
+colint col1
+60 2006-03-17
+select * from t66 order by colint;
+colint col1
+60 2006-03-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- year(col1)-1990 in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with year(col1)-1990
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(year(col1)-1990)
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(year(col1)-1990)
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(year(col1)-1990);
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(year(col1)-1990) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(year(col1)-1990) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with year(col1)-1990
+-------------------------------------------------------------------------
+insert into t1 values ('1996-01-03');
+insert into t1 values ('2000-02-17');
+insert into t2 values ('1996-01-03');
+insert into t2 values ('2000-02-17');
+insert into t2 values ('2004-05-25');
+insert into t3 values ('1996-01-03');
+insert into t3 values ('2000-02-17');
+insert into t3 values ('2004-05-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select year(col1)-1990 from t1 order by col1;
+year(col1)-1990
+6
+10
+select * from t1 order by col1;
+col1
+1996-01-03
+2000-02-17
+select * from t2 order by col1;
+col1
+1996-01-03
+2000-02-17
+2004-05-25
+select * from t3 order by col1;
+col1
+1996-01-03
+2000-02-17
+2004-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2002-02-15' where col1='1996-01-03';
+update t2 set col1='2002-02-15' where col1='1996-01-03';
+update t3 set col1='2002-02-15' where col1='1996-01-03';
+update t4 set col1='2002-02-15' where col1='1996-01-03';
+update t5 set col1='2002-02-15' where col1='1996-01-03';
+update t6 set col1='2002-02-15' where col1='1996-01-03';
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with year(col1)-1990
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(year(col1)-1990)
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(year(col1)-1990)
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(year(col1)-1990);
+alter table t44
+partition by range(colint)
+subpartition by hash(year(col1)-1990) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(year(col1)-1990) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t22 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+alter table t55
+partition by list(colint)
+subpartition by hash(year(col1)-1990) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with year(col1)-1990
+-------------------------------------------------------------------------
+delete from t1 where col1='2000-02-17';
+delete from t2 where col1='2000-02-17';
+delete from t3 where col1='2000-02-17';
+delete from t4 where col1='2000-02-17';
+delete from t5 where col1='2000-02-17';
+delete from t6 where col1='2000-02-17';
+select * from t1 order by col1;
+col1
+2002-02-15
+select * from t2 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2000-02-17');
+insert into t2 values ('2000-02-17');
+insert into t3 values ('2000-02-17');
+insert into t4 values (60,'2000-02-17');
+insert into t5 values (60,'2000-02-17');
+insert into t6 values (60,'2000-02-17');
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+60 2000-02-17
+select * from t5 order by colint;
+colint col1
+60 2000-02-17
+select * from t6 order by colint;
+colint col1
+60 2000-02-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with year(col1)-1990
+-------------------------------------------------------------------------
+delete from t11 where col1='2000-02-17';
+delete from t22 where col1='2000-02-17';
+delete from t33 where col1='2000-02-17';
+delete from t44 where col1='2000-02-17';
+delete from t55 where col1='2000-02-17';
+delete from t66 where col1='2000-02-17';
+select * from t11 order by col1;
+col1
+2002-02-15
+select * from t22 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2000-02-17');
+insert into t22 values ('2000-02-17');
+insert into t33 values ('2000-02-17');
+insert into t44 values (60,'2000-02-17');
+insert into t55 values (60,'2000-02-17');
+insert into t66 values (60,'2000-02-17');
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t22 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+60 2000-02-17
+select * from t55 order by colint;
+colint col1
+60 2000-02-17
+select * from t66 order by colint;
+colint col1
+60 2000-02-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- yearweek(col1)-200600 in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(yearweek(col1)-200600)
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(yearweek(col1)-200600)
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(yearweek(col1)-200600);
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-08-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-08-17');
+insert into t2 values ('2006-03-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-08-17');
+insert into t3 values ('2006-03-25');
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select yearweek(col1)-200600 from t1 order by col1;
+yearweek(col1)-200600
+1
+33
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-08-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-03-25
+2006-08-17
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-03-25
+2006-08-17
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-11-15' where col1='2006-01-03';
+update t2 set col1='2006-11-15' where col1='2006-01-03';
+update t3 set col1='2006-11-15' where col1='2006-01-03';
+update t4 set col1='2006-11-15' where col1='2006-01-03';
+update t5 set col1='2006-11-15' where col1='2006-01-03';
+update t6 set col1='2006-11-15' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(yearweek(col1)-200600)
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(yearweek(col1)-200600)
+(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t33
+partition by hash(yearweek(col1)-200600);
+alter table t44
+partition by range(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 2
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+alter table t55
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 5
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` date DEFAULT NULL
+) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-08-17';
+delete from t2 where col1='2006-08-17';
+delete from t3 where col1='2006-08-17';
+delete from t4 where col1='2006-08-17';
+delete from t5 where col1='2006-08-17';
+delete from t6 where col1='2006-08-17';
+select * from t1 order by col1;
+col1
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t1 values ('2006-08-17');
+insert into t2 values ('2006-08-17');
+insert into t3 values ('2006-08-17');
+insert into t4 values (60,'2006-08-17');
+insert into t5 values (60,'2006-08-17');
+insert into t6 values (60,'2006-08-17');
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+60 2006-08-17
+select * from t5 order by colint;
+colint col1
+60 2006-08-17
+select * from t6 order by colint;
+colint col1
+60 2006-08-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-08-17';
+delete from t22 where col1='2006-08-17';
+delete from t33 where col1='2006-08-17';
+delete from t44 where col1='2006-08-17';
+delete from t55 where col1='2006-08-17';
+delete from t66 where col1='2006-08-17';
+select * from t11 order by col1;
+col1
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+insert into t11 values ('2006-08-17');
+insert into t22 values ('2006-08-17');
+insert into t33 values ('2006-08-17');
+insert into t44 values (60,'2006-08-17');
+insert into t55 values (60,'2006-08-17');
+insert into t66 values (60,'2006-08-17');
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-08-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
+colint col1
+60 2006-08-17
+select * from t55 order by colint;
+colint col1
+60 2006-08-17
+select * from t66 order by colint;
+colint col1
+60 2006-08-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
diff --git a/mysql-test/suite/partitions/r/partition_t55.out b/mysql-test/suite/partitions/r/partition_t55.out
new file mode 100644
index 00000000000..d86ceda8c38
--- /dev/null
+++ b/mysql-test/suite/partitions/r/partition_t55.out
@@ -0,0 +1,68 @@
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYI
+36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYI
+36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYI
+27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYI
+45 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYI
+8594 MYSQL_TEST_DIR/var/master-data/test/t55.frm
+408 MYSQL_TEST_DIR/var/master-data/test/t55.par
diff --git a/mysql-test/suite/partitions/t/disabled.def b/mysql-test/suite/partitions/t/disabled.def
index ede5d6b6e60..212ca0206e2 100644
--- a/mysql-test/suite/partitions/t/disabled.def
+++ b/mysql-test/suite/partitions/t/disabled.def
@@ -13,4 +13,4 @@ partition_alter2_ndb : cannot create t1
partition_char_innodb : crash. Bug? More investigations
partition_sessions : needs system_3_init.inc
partition_engine_ndb : cannot create t1
-
+partition_supported_sql_func_ndb : cannot create t1
diff --git a/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test b/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test
index 4440f814d1e..135c869c841 100644
--- a/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test
+++ b/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test
@@ -2,8 +2,8 @@
# t/partition_supported_sql_funcs_innodb.test #
# #
# Purpose: #
-# Tests around sql functions #
-# INNODB branch #
+# Tests which SQL functions are allowed in partinioning clauses with #
+# INNODB. #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
@@ -18,16 +18,12 @@
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
-# Please read the README at the end of include/partition.pre before changing
-# any of the variables.
-#
-
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
-let $do_long_tests= 0;
+let $do_long_tests= 1;
# The server must support partitioning.
--source include/have_partition.inc
diff --git a/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test b/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test
index 3daa72c7ff7..131a5e23f39 100644
--- a/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test
+++ b/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test
@@ -2,8 +2,8 @@
# t/partition_supported_sql_funcs_myisam.test #
# #
# Purpose: #
-# Tests around sql functions #
-# MyISAM branch #
+# Tests which SQL functions are allowed in partinioning clauses with #
+# MYISAM. #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
@@ -27,7 +27,7 @@
##### Options, for debugging support #####
let $debug= 0;
-let $do_long_tests= 0;
+let $do_long_tests= 1;
# The server must support partitioning.
--source include/have_partition.inc
diff --git a/mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test b/mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test
new file mode 100644
index 00000000000..2a536fbce94
--- /dev/null
+++ b/mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test
@@ -0,0 +1,40 @@
+################################################################################
+# t/partition_supported_sql_funcs_myisam.test #
+# #
+# Purpose: #
+# Tests which SQL functions are allowed in partinioning clauses with #
+# NDB. #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-11-22 #
+# Change Author: #
+# Change Date: #
+# Change: #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT NDB SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+let $do_long_tests= 1;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+--source include/have_ndb.inc
+##### Storage engine to be tested
+let $engine= 'NDB';
+
+#------------------------------------------------------------------------------#
+--source suite/partitions/include/partition_supported_sql_funcs_main.inc
+# --source include/partition_supported_sql_funcs_main.inc
+
diff --git a/mysql-test/suite/row_lock/include/row_lock.inc b/mysql-test/suite/row_lock/include/row_lock.inc
new file mode 100644
index 00000000000..8572bc0246e
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock.inc
@@ -0,0 +1,83 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+COMMIT;
+SELECT @@global.tx_isolation;
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab.inc
new file mode 100644
index 00000000000..f0823067eac
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_big_tab.inc
@@ -0,0 +1,94 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext2;
+DELIMITER |;
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT count(*)/2 INTO res FROM t1;
+ RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT count(*)/2 INTO res FROM t2;
+ RETURN res;
+END;
+|
+DELIMITER ;|
+CALL fill_t1 (10);
+CALL fill_t2 (10);
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT k from t1 WHERE k < half_t1();
+SELECT k from t1 WHERE k >= half_t1();
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
+#DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
new file mode 100644
index 00000000000..8535c016819
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
@@ -0,0 +1,93 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext2;
+DELIMITER |;
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT MOD(k,2) INTO res FROM t1;
+ RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT MOD(k,2) INTO res FROM t2;
+ RETURN res;
+END;
+|
+DELIMITER ;|
+eval CALL fill_t1 ($nbrows);
+eval CALL fill_t2 ($nbrows);
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
new file mode 100644
index 00000000000..050f2a54016
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
@@ -0,0 +1,93 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext2;
+DELIMITER |;
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT MOD(k,2) INTO res FROM t1;
+ RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT MOD(k,2) INTO res FROM t2;
+ RETURN res;
+END;
+|
+DELIMITER ;|
+eval CALL fill_t1 ($nbrows);
+eval CALL fill_t2 ($nbrows);
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+#SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k FOR UPDATE;
+DELETE FROM t1 WHERE t1.k % 2 = 1;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_trig.inc b/mysql-test/suite/row_lock/include/row_lock_trig.inc
new file mode 100644
index 00000000000..384f00f243e
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_trig.inc
@@ -0,0 +1,96 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+DELIMITER |;
+
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+ FOR EACH ROW BEGIN
+ UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+ END;
+|
+
+DELIMITER ;|
+
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+--echo connection root1;
+CONNECTION root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+#DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_view.inc b/mysql-test/suite/row_lock/include/row_lock_view.inc
new file mode 100644
index 00000000000..fbed8f64d3a
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_view.inc
@@ -0,0 +1,89 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE v1 SET i=325 where i=125;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE v1 SET i=326 where i=126;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
+#DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_mix.inc b/mysql-test/suite/row_lock/include/row_lock_view_mix.inc
new file mode 100644
index 00000000000..9e8cf3d34fc
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_view_mix.inc
@@ -0,0 +1,92 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+#UPDATE v1 SET i=325 where i=125;
+#SELECT * FROM v1 ORDER BY i,l;
+#SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
+#DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc b/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
new file mode 100644
index 00000000000..479392098be
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
@@ -0,0 +1,126 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+DROP PROCEDURE IF EXISTS stp_t;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+CONNECT (root2, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+eval $indext2;
+CREATE VIEW v1 AS SELECT t1.i from t1;
+DELIMITER |;
+
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+ BEGIN
+ UPDATE t2 SET i = p2 WHERE i = p1;
+ UPDATE v1 SET i = p2 WHERE i = p1;
+ SELECT * FROM v1 ORDER BY i;
+ SELECT * FROM t1 ORDER BY t1.k;
+ SELECT * FROM t2 ORDER BY t2.k;
+ END;
+|
+
+DELIMITER ;|
+
+COMMIT;
+SELECT @@global.tx_isolation;
+eval EXPLAIN $select;
+eval $select;
+--echo connection root1;
+CONNECTION root1;
+CALL stp_t (125, 225);
+
+--echo connection root2;
+CONNECTION root2;
+CALL stp_t (127, 227);
+
+--echo connection default;
+CONNECTION default;
+CALL stp_t (123, 223);
+
+--echo connection root1;
+CONNECTION root1;
+CALL stp_t (126, 226);
+
+--echo connection root2;
+CONNECTION root2;
+CALL stp_t (128, 228);
+
+--echo connection default;
+CONNECTION default;
+CALL stp_t (124, 224);
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root2;
+CONNECTION root2;
+DELETE FROM t1 WHERE t1.i=228;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection root1;
+CONNECTION root1;
+COMMIT;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+
+--echo connection root2;
+CONNECTION root2;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root2;
+
+--echo connection default;
+CONNECTION default;
+--disable_warnings
+DROP VIEW v1;
+DROP PROCEDURE stp_t;
+DROP TABLE t1, t2;
+--enable_warnings
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_trig.inc b/mysql-test/suite/row_lock/include/row_lock_view_trig.inc
new file mode 100644
index 00000000000..785eb1b66a9
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_view_trig.inc
@@ -0,0 +1,99 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+CREATE VIEW v1 AS SELECT t1.i from t1;
+DELIMITER |;
+
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+ FOR EACH ROW BEGIN
+ UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+ END;
+|
+
+DELIMITER ;|
+
+COMMIT;
+SELECT @@global.tx_isolation;
+eval EXPLAIN $select;
+eval $select;
+--echo connection root1;
+CONNECTION root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_1.result
new file mode 100644
index 00000000000..54ed4350ba9
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_1.result
@@ -0,0 +1,142 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_2.result
new file mode 100644
index 00000000000..56154e64489
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_2.result
@@ -0,0 +1,32 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_3.result b/mysql-test/suite/row_lock/r/innodb_row_lock_3.result
new file mode 100644
index 00000000000..a89c55973d2
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_3.result
@@ -0,0 +1,32 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_4.result b/mysql-test/suite/row_lock/r/innodb_row_lock_4.result
new file mode 100644
index 00000000000..310d24a456a
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_4.result
@@ -0,0 +1,142 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_5.result b/mysql-test/suite/row_lock/r/innodb_row_lock_5.result
new file mode 100644
index 00000000000..ace5fddfad5
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_5.result
@@ -0,0 +1,32 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
new file mode 100644
index 00000000000..8f00c3a0bb7
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
@@ -0,0 +1,97 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT count(*)/2 INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT count(*)/2 INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (10);
+CALL fill_t2 (10);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 10 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+connection root1;
+SELECT k from t1 WHERE k < half_t1();
+k
+0
+1
+2
+3
+4
+SELECT k from t1 WHERE k >= half_t1();
+k
+5
+6
+7
+8
+9
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 1111 0 100
+1 1111 1 101
+2 1111 2 102
+3 1111 3 103
+4 1111 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 2222 0 100
+1 2222 1 101
+2 2222 2 102
+3 2222 3 103
+4 2222 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+connection default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
new file mode 100644
index 00000000000..0b12f149193
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
@@ -0,0 +1,145 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (40);
+CALL fill_t2 (40);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+i i
+100 100
+102 102
+104 104
+106 106
+108 108
+110 110
+112 112
+114 114
+116 116
+118 118
+120 120
+122 122
+124 124
+126 126
+128 128
+130 130
+132 132
+134 134
+136 136
+138 138
+connection root1;
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
+i i
+101 101
+103 103
+105 105
+107 107
+109 109
+111 111
+113 113
+115 115
+117 117
+119 119
+121 121
+123 123
+125 125
+127 127
+129 129
+131 131
+133 133
+135 135
+137 137
+139 139
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+k i j l
+0 100 0 100
+1 1111 1 101
+2 102 2 102
+3 1111 3 103
+4 104 4 104
+5 1111 5 105
+6 106 6 106
+7 1111 7 107
+8 108 8 108
+9 1111 9 109
+10 110 10 110
+11 1111 11 111
+12 112 12 112
+13 1111 13 113
+14 114 14 114
+15 1111 15 115
+16 116 16 116
+17 1111 17 117
+18 118 18 118
+19 1111 19 119
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 2222 1 101
+2 102 2 102
+3 2222 3 103
+4 104 4 104
+5 2222 5 105
+6 106 6 106
+7 2222 7 107
+8 108 8 108
+9 2222 9 109
+10 110 10 110
+11 2222 11 111
+12 112 12 112
+13 2222 13 113
+14 114 14 114
+15 2222 15 115
+16 116 16 116
+17 2222 17 117
+18 118 18 118
+19 2222 19 119
+connection default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
new file mode 100644
index 00000000000..cc9f297f9fb
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
@@ -0,0 +1,113 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (40);
+CALL fill_t2 (40);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+i i
+100 100
+102 102
+104 104
+106 106
+108 108
+110 110
+112 112
+114 114
+116 116
+118 118
+120 120
+122 122
+124 124
+126 126
+128 128
+130 130
+132 132
+134 134
+136 136
+138 138
+connection root1;
+DELETE FROM t1 WHERE t1.k % 2 = 1;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+k i j l
+0 100 0 100
+2 102 2 102
+4 104 4 104
+6 106 6 106
+8 108 8 108
+10 110 10 110
+12 112 12 112
+14 114 14 114
+16 116 16 116
+18 118 18 118
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+10 110 10 110
+11 111 11 111
+12 112 12 112
+13 113 13 113
+14 114 14 114
+15 115 15 115
+16 116 16 116
+17 117 17 117
+18 118 18 118
+19 119 19 119
+connection default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
new file mode 100644
index 00000000000..dd43e5752e5
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
@@ -0,0 +1,151 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 226
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 226
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
new file mode 100644
index 00000000000..cb3a5c692e9
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
@@ -0,0 +1,37 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
new file mode 100644
index 00000000000..834cb669833
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
@@ -0,0 +1,34 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE v1 SET i=325 where i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
new file mode 100644
index 00000000000..440138d4cd1
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
@@ -0,0 +1,40 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
+SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+i
+123
+124
+123
+124
+123
+124
+123
+124
+connection root1;
+UPDATE v1 SET i=325 where i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result
new file mode 100644
index 00000000000..230873b67a0
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result
@@ -0,0 +1,48 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE v1 SET i=323 where i=123;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result
new file mode 100644
index 00000000000..d792d573f8e
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result
@@ -0,0 +1,40 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
+SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+i
+123
+124
+123
+124
+123
+124
+123
+124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result
new file mode 100644
index 00000000000..77b9a4dd964
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result
@@ -0,0 +1,312 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+BEGIN
+UPDATE t2 SET i = p2 WHERE i = p1;
+UPDATE v1 SET i = p2 WHERE i = p1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 6 Using where; Using index
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+CALL stp_t (125, 225);
+i
+123
+124
+126
+127
+128
+225
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+CALL stp_t (127, 227);
+i
+123
+124
+125
+126
+128
+227
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 128 6 128
+connection default;
+CALL stp_t (123, 223);
+i
+124
+125
+126
+127
+128
+223
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+CALL stp_t (126, 226);
+i
+123
+124
+127
+128
+225
+226
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+CALL stp_t (128, 228);
+i
+123
+124
+125
+126
+227
+228
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+CALL stp_t (124, 224);
+i
+125
+126
+127
+128
+223
+224
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+DELETE FROM t1 WHERE t1.i=228;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+COMMIT;
+connection root1;
+ROLLBACK;
+connection root1;
+COMMIT;
+connection default;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+127
+128
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+127
+128
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+125
+126
+227
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+DROP TABLE t1, t2;
+DROP VIEW v1;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result
new file mode 100644
index 00000000000..73d8a3f4bea
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result
@@ -0,0 +1,47 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+#CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+BEGIN
+UPDATE t2 SET i = p2 WHERE i = p1;
+UPDATE v1 SET i = p2 WHERE i = p1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+CALL stp_t (125, 225);
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
new file mode 100644
index 00000000000..90383a9489f
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
@@ -0,0 +1,183 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+126
+225
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM v1 ORDER BY i;
+i
+124
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+225
+226
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+224
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+DROP VIEW v1;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result
new file mode 100644
index 00000000000..55793558b21
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result
@@ -0,0 +1,38 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_1.result
new file mode 100644
index 00000000000..248c7d5ea1f
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_1.result
@@ -0,0 +1,139 @@
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_2.result
new file mode 100644
index 00000000000..109d99dd036
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_2.result
@@ -0,0 +1,31 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_3.result b/mysql-test/suite/row_lock/r/ndb_row_lock_3.result
new file mode 100644
index 00000000000..c936ea209ff
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_3.result
@@ -0,0 +1,30 @@
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_4.result b/mysql-test/suite/row_lock/r/ndb_row_lock_4.result
new file mode 100644
index 00000000000..875c783bd81
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_4.result
@@ -0,0 +1,139 @@
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_5.result b/mysql-test/suite/row_lock/r/ndb_row_lock_5.result
new file mode 100644
index 00000000000..0d94f8abf72
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_5.result
@@ -0,0 +1,30 @@
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
new file mode 100644
index 00000000000..94b67c63d94
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
@@ -0,0 +1,177 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT count(*)/2 INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT count(*)/2 INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (10);
+CALL fill_t2 (10);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+connection root1;
+SELECT k from t1 WHERE k < half_t1();
+k
+0
+3
+1
+2
+4
+SELECT k from t1 WHERE k >= half_t1();
+k
+6
+7
+9
+5
+8
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 1111 0 100
+1 1111 1 101
+2 1111 2 102
+3 1111 3 103
+4 1111 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 2222 0 100
+1 2222 1 101
+2 2222 2 102
+3 2222 3 103
+4 2222 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+connection default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 3333 5 105
+6 3333 6 106
+7 3333 7 107
+8 3333 8 108
+9 3333 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 4444 5 105
+6 4444 6 106
+7 4444 7 107
+8 4444 8 108
+9 4444 9 109
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 3333 5 105
+6 3333 6 106
+7 3333 7 107
+8 3333 8 108
+9 3333 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 4444 5 105
+6 4444 6 106
+7 4444 7 107
+8 4444 8 108
+9 4444 9 109
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 3333 5 105
+6 3333 6 106
+7 3333 7 107
+8 3333 8 108
+9 3333 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 4444 5 105
+6 4444 6 106
+7 4444 7 107
+8 4444 8 108
+9 4444 9 109
+connection default;
+DROP VIEW IF EXISTS v1;
+Warnings:
+Note 1051 Unknown table 'test.v1'
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
new file mode 100644
index 00000000000..9803895e1a7
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
@@ -0,0 +1,357 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (200);
+CALL fill_t2 (200);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+i i
+135 135
+119 119
+211 211
+184 184
+232 232
+105 105
+188 188
+216 216
+255 255
+154 154
+197 197
+279 279
+218 218
+127 127
+203 203
+281 281
+194 194
+161 161
+276 276
+122 122
+139 139
+183 183
+114 114
+247 247
+144 144
+148 148
+174 174
+267 267
+142 142
+168 168
+226 226
+258 258
+231 231
+146 146
+253 253
+189 189
+230 230
+290 290
+178 178
+158 158
+130 130
+214 214
+133 133
+229 229
+294 294
+295 295
+108 108
+112 112
+297 297
+151 151
+251 251
+270 270
+291 291
+159 159
+132 132
+121 121
+244 244
+272 272
+293 293
+186 186
+111 111
+166 166
+201 201
+175 175
+180 180
+209 209
+192 192
+246 246
+195 195
+107 107
+233 233
+239 239
+103 103
+109 109
+128 128
+266 266
+143 143
+160 160
+187 187
+243 243
+273 273
+259 259
+110 110
+176 176
+141 141
+170 170
+215 215
+191 191
+200 200
+271 271
+162 162
+260 260
+106 106
+150 150
+126 126
+147 147
+155 155
+193 193
+207 207
+287 287
+235 235
+252 252
+129 129
+205 205
+268 268
+278 278
+116 116
+137 137
+199 199
+217 217
+234 234
+190 190
+236 236
+257 257
+100 100
+210 210
+212 212
+264 264
+221 221
+241 241
+256 256
+262 262
+265 265
+269 269
+277 277
+173 173
+177 177
+208 208
+219 219
+285 285
+101 101
+164 164
+113 113
+125 125
+202 202
+140 140
+156 156
+282 282
+181 181
+206 206
+299 299
+102 102
+145 145
+227 227
+196 196
+138 138
+198 198
+204 204
+237 237
+171 171
+284 284
+263 263
+292 292
+104 104
+149 149
+250 250
+296 296
+228 228
+280 280
+242 242
+248 248
+185 185
+220 220
+245 245
+275 275
+118 118
+120 120
+152 152
+153 153
+157 157
+182 182
+179 179
+254 254
+288 288
+172 172
+283 283
+286 286
+115 115
+238 238
+289 289
+131 131
+223 223
+134 134
+136 136
+222 222
+225 225
+261 261
+274 274
+123 123
+163 163
+224 224
+117 117
+298 298
+169 169
+124 124
+167 167
+240 240
+249 249
+165 165
+213 213
+connection root1;
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
+i i
+209 209
+195 195
+107 107
+233 233
+239 239
+103 103
+109 109
+143 143
+187 187
+243 243
+273 273
+259 259
+141 141
+215 215
+191 191
+271 271
+147 147
+155 155
+193 193
+207 207
+287 287
+235 235
+129 129
+205 205
+137 137
+199 199
+217 217
+257 257
+221 221
+241 241
+265 265
+269 269
+277 277
+173 173
+177 177
+135 135
+119 119
+211 211
+105 105
+255 255
+197 197
+279 279
+127 127
+203 203
+281 281
+161 161
+139 139
+183 183
+247 247
+267 267
+231 231
+253 253
+189 189
+133 133
+229 229
+295 295
+297 297
+151 151
+251 251
+291 291
+159 159
+121 121
+293 293
+111 111
+201 201
+175 175
+185 185
+245 245
+275 275
+153 153
+157 157
+179 179
+283 283
+115 115
+289 289
+131 131
+223 223
+225 225
+261 261
+123 123
+163 163
+117 117
+169 169
+167 167
+249 249
+165 165
+213 213
+219 219
+285 285
+101 101
+113 113
+125 125
+181 181
+299 299
+145 145
+227 227
+237 237
+171 171
+263 263
+149 149
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
new file mode 100644
index 00000000000..adb89b03480
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
@@ -0,0 +1,255 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (200);
+CALL fill_t2 (200);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+i i
+135 135
+119 119
+211 211
+184 184
+232 232
+105 105
+188 188
+216 216
+255 255
+154 154
+197 197
+279 279
+218 218
+127 127
+203 203
+281 281
+194 194
+161 161
+276 276
+122 122
+139 139
+183 183
+114 114
+247 247
+144 144
+148 148
+174 174
+267 267
+142 142
+168 168
+226 226
+258 258
+231 231
+146 146
+253 253
+189 189
+230 230
+290 290
+178 178
+158 158
+130 130
+214 214
+133 133
+229 229
+294 294
+295 295
+108 108
+112 112
+297 297
+151 151
+251 251
+270 270
+291 291
+159 159
+132 132
+121 121
+244 244
+272 272
+293 293
+186 186
+111 111
+166 166
+201 201
+175 175
+180 180
+209 209
+192 192
+246 246
+195 195
+107 107
+233 233
+239 239
+103 103
+109 109
+128 128
+266 266
+143 143
+160 160
+187 187
+243 243
+273 273
+259 259
+110 110
+176 176
+141 141
+170 170
+215 215
+191 191
+200 200
+271 271
+162 162
+260 260
+106 106
+150 150
+126 126
+147 147
+155 155
+193 193
+207 207
+287 287
+235 235
+252 252
+129 129
+205 205
+268 268
+278 278
+116 116
+137 137
+199 199
+217 217
+234 234
+190 190
+236 236
+257 257
+100 100
+210 210
+212 212
+264 264
+221 221
+241 241
+256 256
+262 262
+265 265
+269 269
+277 277
+173 173
+177 177
+208 208
+219 219
+285 285
+101 101
+164 164
+113 113
+125 125
+202 202
+140 140
+156 156
+282 282
+181 181
+206 206
+299 299
+102 102
+145 145
+227 227
+196 196
+138 138
+198 198
+204 204
+237 237
+171 171
+284 284
+263 263
+292 292
+104 104
+149 149
+250 250
+296 296
+228 228
+280 280
+242 242
+248 248
+185 185
+220 220
+245 245
+275 275
+118 118
+120 120
+152 152
+153 153
+157 157
+182 182
+179 179
+254 254
+288 288
+172 172
+283 283
+286 286
+115 115
+238 238
+289 289
+131 131
+223 223
+134 134
+136 136
+222 222
+225 225
+261 261
+274 274
+123 123
+163 163
+224 224
+117 117
+298 298
+169 169
+124 124
+167 167
+240 240
+249 249
+165 165
+213 213
+connection root1;
+DELETE FROM t1 WHERE t1.k % 2 = 1;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
new file mode 100644
index 00000000000..eb69fd2e306
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
@@ -0,0 +1,148 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 226
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 226
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
new file mode 100644
index 00000000000..bedb75da93a
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
@@ -0,0 +1,35 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
new file mode 100644
index 00000000000..279f2626c73
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
@@ -0,0 +1,194 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE v1 SET i=325 where i=125;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+123 123
+123 124
+123 125
+123 126
+124 123
+124 124
+124 125
+124 126
+126 123
+126 124
+126 125
+126 126
+325 123
+325 124
+325 125
+325 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 126 4 126
+connection default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+124 123
+124 124
+124 125
+124 126
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE v1 SET i=326 where i=126;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+123 123
+123 124
+123 125
+123 126
+124 123
+124 124
+124 125
+124 126
+325 123
+325 124
+325 125
+325 126
+326 123
+326 124
+326 125
+326 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 326 4 126
+connection default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+324 123
+324 124
+324 125
+324 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 326 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
new file mode 100644
index 00000000000..9e74e93b0cc
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
@@ -0,0 +1,200 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+i
+123
+124
+123
+124
+123
+124
+123
+124
+connection root1;
+UPDATE v1 SET i=325 where i=125;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+123 123
+123 124
+123 125
+123 126
+124 123
+124 124
+124 125
+124 126
+126 123
+126 124
+126 125
+126 126
+325 123
+325 124
+325 125
+325 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 126 4 126
+connection default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+124 123
+124 124
+124 125
+124 126
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE v1 SET i=326 where i=126;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+123 123
+123 124
+123 125
+123 126
+124 123
+124 124
+124 125
+124 126
+325 123
+325 124
+325 125
+325 126
+326 123
+326 124
+326 125
+326 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 326 4 126
+connection default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+324 123
+324 124
+324 125
+324 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 326 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
new file mode 100644
index 00000000000..b5b1c519702
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
@@ -0,0 +1,169 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+124 123
+124 124
+124 125
+124 126
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+324 123
+324 124
+324 125
+324 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
new file mode 100644
index 00000000000..d92f9ad9664
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
@@ -0,0 +1,38 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+i
+123
+124
+123
+124
+123
+124
+123
+124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
new file mode 100644
index 00000000000..e2a2a6e7deb
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
@@ -0,0 +1,309 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+DROP PROCEDURE IF EXISTS stp_t;
+SET autocommit=0;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+BEGIN
+UPDATE t2 SET i = p2 WHERE i = p1;
+UPDATE v1 SET i = p2 WHERE i = p1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+CALL stp_t (125, 225);
+i
+123
+124
+126
+127
+128
+225
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+CALL stp_t (127, 227);
+i
+123
+124
+125
+126
+128
+227
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 128 6 128
+connection default;
+CALL stp_t (123, 223);
+i
+124
+125
+126
+127
+128
+223
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+CALL stp_t (126, 226);
+i
+123
+124
+127
+128
+225
+226
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+CALL stp_t (128, 228);
+i
+123
+124
+125
+126
+227
+228
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+CALL stp_t (124, 224);
+i
+125
+126
+127
+128
+223
+224
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+DELETE FROM t1 WHERE t1.i=228;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+COMMIT;
+connection root1;
+ROLLBACK;
+connection root1;
+COMMIT;
+connection default;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+127
+128
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+127
+128
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+227
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 227 5 127
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+DROP VIEW v1;
+DROP PROCEDURE stp_t;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result
new file mode 100644
index 00000000000..6dbd5f834ed
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result
@@ -0,0 +1,46 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+DROP PROCEDURE IF EXISTS stp_t;
+SET autocommit=0;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+#CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+BEGIN
+UPDATE t2 SET i = p2 WHERE i = p1;
+UPDATE v1 SET i = p2 WHERE i = p1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+CALL stp_t (125, 225);
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
new file mode 100644
index 00000000000..f5c745ca41c
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
@@ -0,0 +1,180 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+126
+225
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM v1 ORDER BY i;
+i
+124
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+225
+226
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+224
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+DROP VIEW v1;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
new file mode 100644
index 00000000000..d6a38753c1d
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
@@ -0,0 +1,36 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/readme.txt b/mysql-test/suite/row_lock/readme.txt
new file mode 100644
index 00000000000..b43f04ecda4
--- /dev/null
+++ b/mysql-test/suite/row_lock/readme.txt
@@ -0,0 +1,9 @@
+All row lock test with InnoDB have to be executed with the options
+
+--innodb_lock_wait_timeout=1
+--innodb_locks_unsafe_for_binlog
+
+for example
+
+perl mysql-test-run.pl --mysqld=--innodb_lock_wait_timeout=2 --mysqld=--innodb_locks_unsafe_for_binlog --suite=row_lock innodb_row_lock_2
+
diff --git a/mysql-test/suite/row_lock/summary_of_sel_test.txt b/mysql-test/suite/row_lock/summary_of_sel_test.txt
new file mode 100644
index 00000000000..0fa332e957a
--- /dev/null
+++ b/mysql-test/suite/row_lock/summary_of_sel_test.txt
@@ -0,0 +1,36 @@
+Test plan:
+Create 2 tables with a primary key and 3 integer columns. Both get the same rows (1,123,1,123),(2,124,2,124),(3,125,3,125),(4,126,4,126). The second and third column may get an index to have cases with, without and mutilple index. Create views on the tables. Create an update trigger. Create a stored procedure updating the table. Create a stored function updating the table and deliver the key as result.
+
+The test isself consists of 2 sessions (transactions) running in "parallel" (same user "root") accessing and locking the same tables on basis of a row lock. Expected is that both sessions(transactions) can update the table successfully.
+
+First session
+execute an explain to every select and one of the following selects on the first half of table t1:
+- select <non index columns> ... where ... for update;
+- select <non index columns> ... where ... lock in share mode;
+- select <indexed columns> ... where ... for update;
+- select <indexed columns> ... where ... lock in share mode;
+- select <indexed columns> ... ignore index ... where ... for update;
+- select <indexed columns> ... ignore index ... where ... lock in share mode;
+- select ... where (select...) ... for update;
+- select ... where (select...) ... lock in share mode;
+- (select ... where) union (select ... where) for update;
+- (select ... where) union (select ... where) lock in...;
+- select <view> ... where ... for update;
+- select <view> ... where ... lock in ...;
+- select <join> ... where ... for update;
+- select <join> ... where ... lock in ...;
+Then executes
+- update
+- delete
+- trigger accessing table t1
+- stored procedure accessing table t1
+- stored function accessing table t1
+
+Second session
+executes the same on the last half of table t1
+
+call of mysqld with option
+--innodb_locks_unsafe_for_binlog
+
+As the tests above work with small tables (<10 rows) there must be at least one test with a big table (>1000 rows) doing a table scan.
+
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_1.test
new file mode 100644
index 00000000000..e0440fe2669
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_2.test
new file mode 100644
index 00000000000..5cb3ea9f2d9
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_3.test b/mysql-test/suite/row_lock/t/innodb_row_lock_3.test
new file mode 100644
index 00000000000..11f4dc423d6
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_3.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_4.test b/mysql-test/suite/row_lock/t/innodb_row_lock_4.test
new file mode 100644
index 00000000000..0a8ca9c13a0
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_4.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_5.test b/mysql-test/suite/row_lock/t/innodb_row_lock_5.test
new file mode 100644
index 00000000000..7e411d31649
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_5.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
new file mode 100644
index 00000000000..0c5b8b41bd5
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
new file mode 100644
index 00000000000..a12a07d82a9
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
@@ -0,0 +1,10 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $nbrows= 40;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab_1.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
new file mode 100644
index 00000000000..49e834eb2ce
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
@@ -0,0 +1,10 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $nbrows= 40;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab_2.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
new file mode 100644
index 00000000000..225513d3f87
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_trig.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
new file mode 100644
index 00000000000..88dee5f23f8
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_trig.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
new file mode 100644
index 00000000000..d6381e1da5b
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
new file mode 100644
index 00000000000..ee45e683669
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test
new file mode 100644
index 00000000000..49cba88dd23
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_mix.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
new file mode 100644
index 00000000000..b07f3a3378a
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
@@ -0,0 +1,10 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+#let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_mix.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test
new file mode 100644
index 00000000000..d507ff3296f
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_storedp.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test
new file mode 100644
index 00000000000..a1bfb16055e
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_storedp.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test
new file mode 100644
index 00000000000..24c76532d17
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_trig.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test
new file mode 100644
index 00000000000..a8a67d77979
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_trig.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_1.test
new file mode 100644
index 00000000000..6ac2e829008
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_2.test
new file mode 100644
index 00000000000..994ecba96b0
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_3.test b/mysql-test/suite/row_lock/t/ndb_row_lock_3.test
new file mode 100644
index 00000000000..2de43c61c2a
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_3.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_4.test b/mysql-test/suite/row_lock/t/ndb_row_lock_4.test
new file mode 100644
index 00000000000..72b20488c74
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_4.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_5.test b/mysql-test/suite/row_lock/t/ndb_row_lock_5.test
new file mode 100644
index 00000000000..045f127a4ef
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_5.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
new file mode 100644
index 00000000000..bf2df104e03
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
new file mode 100644
index 00000000000..4d32991d379
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
@@ -0,0 +1,7 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $nbrows= 200;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab_1.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
new file mode 100644
index 00000000000..894a83fc1b0
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
@@ -0,0 +1,7 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $nbrows= 200;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab_2.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
new file mode 100644
index 00000000000..a5586a6101e
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
new file mode 100644
index 00000000000..7af13697ccc
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
new file mode 100644
index 00000000000..a1aaf5ab441
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
@@ -0,0 +1,7 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view.inc
+
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
new file mode 100644
index 00000000000..b8feef693e7
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
new file mode 100644
index 00000000000..a97626048d3
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_mix.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
new file mode 100644
index 00000000000..e7a9a715785
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_mix.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test
new file mode 100644
index 00000000000..f57bcb3dd1b
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_storedp.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test
new file mode 100644
index 00000000000..b0aaa38fb93
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_storedp.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test
new file mode 100644
index 00000000000..9c4128d78bf
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test
new file mode 100644
index 00000000000..38c9472fb3d
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_trig.inc
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index 183c57c0c04..8c625dc70a4 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -683,12 +683,12 @@ INSERT INTO t1 VALUES(1, 'test1');
CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1;
==========MASTER==========
SHOW EVENTS;
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
test_rpl e1 root@localhost RECURRING NULL 1 SECOND # # ENABLED
==========SLAVE===========
USE test_rpl;
SHOW EVENTS;
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
==========MASTER==========
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -742,12 +742,12 @@ a b
ALTER EVENT e1 RENAME TO e2;
==========MASTER==========
SHOW EVENTS;
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
test_rpl e2 root@localhost RECURRING NULL 1 SECOND # # ENABLED
==========SLAVE===========
USE test_rpl;
SHOW EVENTS;
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
==========MASTER==========
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -776,11 +776,11 @@ a b
DROP EVENT e2;
==========MASTER==========
SHOW EVENTS;
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
==========SLAVE===========
USE test_rpl;
SHOW EVENTS;
-Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
DELETE FROM t1;
DELETE FROM t2;
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 297813dfead..b8ba35b78ca 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -642,6 +642,33 @@ alter table t1 change t t text;
drop table t1;
#
+# Bug #26794: Adding an index with a prefix on a SPATIAL type breaks ALTER
+# TABLE
+#
+CREATE TABLE t1 (a varchar(500));
+
+ALTER TABLE t1 ADD b GEOMETRY NOT NULL, ADD SPATIAL INDEX(b);
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ADD KEY(b(50));
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 ADD c POINT;
+SHOW CREATE TABLE t1;
+
+--error ER_WRONG_SUB_KEY
+CREATE TABLE t2 (a INT, KEY (a(20)));
+
+ALTER TABLE t1 ADD d INT;
+--error ER_WRONG_SUB_KEY
+ALTER TABLE t1 ADD KEY (d(20));
+
+# the 5.1 part of the test
+--error ER_WRONG_SUB_KEY
+ALTER TABLE t1 ADD e GEOMETRY NOT NULL, ADD SPATIAL KEY (e(30));
+
+DROP TABLE t1;
+
+#
# Bug#18038 MySQL server corrupts binary columns data
#
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index b2e720cb900..b5ace75dbc4 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -1540,3 +1540,13 @@ SHOW CREATE TABLE t6;
--disable_warnings
DROP TABLE t1, t2, t4, t5, t6;
--enable_warnings
+
+#
+# BUG#26138 - REPAIR TABLE with option USE_FRM erases all records in ARCHIVE
+# table
+#
+create table t1 (i int) engine=archive;
+insert into t1 values (1);
+repair table t1 use_frm;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/binlog_row_mix_innodb_myisam.test b/mysql-test/t/binlog_row_mix_innodb_myisam.test
index b131e5350af..335a05be146 100644
--- a/mysql-test/t/binlog_row_mix_innodb_myisam.test
+++ b/mysql-test/t/binlog_row_mix_innodb_myisam.test
@@ -20,7 +20,7 @@
# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
# and does not make slave to stop)
flush logs;
---exec $MYSQL_BINLOG --start-position=516 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+--exec $MYSQL_BINLOG --start-position=520 $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"))
diff --git a/mysql-test/t/binlog_stm_mix_innodb_myisam.test b/mysql-test/t/binlog_stm_mix_innodb_myisam.test
index 8d7399b918e..72651c13be7 100644
--- a/mysql-test/t/binlog_stm_mix_innodb_myisam.test
+++ b/mysql-test/t/binlog_stm_mix_innodb_myisam.test
@@ -12,7 +12,7 @@
# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
# and does not make slave to stop)
flush logs;
---exec $MYSQL_BINLOG --start-position=551 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+--exec $MYSQL_BINLOG --start-position=555 $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"))
diff --git a/mysql-test/t/client_xml.test b/mysql-test/t/client_xml.test
index 017b7a1569a..8ee63a6131b 100644
--- a/mysql-test/t/client_xml.test
+++ b/mysql-test/t/client_xml.test
@@ -17,5 +17,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
--exec $MYSQL --xml test -e "select 1 > 2 from dual"
--exec $MYSQL --xml test -e "select 1 & 3 from dual"
--exec $MYSQL --xml test -e "select null from dual"
+--exec $MYSQL --xml test -e "select 1 limit 0"
+--exec $MYSQL --xml test -vv -e "select 1 limit 0"
drop table t1;
diff --git a/mysql-test/t/compress.test b/mysql-test/t/compress.test
index 3f1892b5dec..cd40aef002c 100644
--- a/mysql-test/t/compress.test
+++ b/mysql-test/t/compress.test
@@ -10,6 +10,7 @@ connect (comp_con,localhost,root,,,,,COMPRESS);
# Check compression turned on
SHOW STATUS LIKE 'Compression';
+select * from information_schema.session_status where variable_name= 'COMPRESSION';
# Source select test case
-- source include/common-tests.inc
diff --git a/mysql-test/t/crash_commit_before.test b/mysql-test/t/crash_commit_before.test
index 5a91cd7a7ad..4e212d81e66 100644
--- a/mysql-test/t/crash_commit_before.test
+++ b/mysql-test/t/crash_commit_before.test
@@ -30,3 +30,6 @@ COMMIT;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
+
+
+DROP TABLE t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index ffdcee06488..5fca63a295c 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -660,6 +660,7 @@ create table t1(a set("a,b","c,d") not null);
# End of 4.1 tests
+
#
# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
# platforms
@@ -678,7 +679,7 @@ drop table t1;
create table t1 (upgrade int);
drop table t1;
-# End of 5.0 tests
+--echo End of 5.0 tests
#
# Test of behaviour with CREATE ... SELECT
@@ -734,3 +735,95 @@ drop database mysqltest;
USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
--error 1102
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+#
+# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
+#
+set names utf8;
+
+create database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+use имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+select database();
+use test;
+
+select SCHEMA_NAME from information_schema.schemata
+where schema_name='имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45';
+
+drop database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48
+(
+ имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45 int,
+ index имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48 (имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45)
+);
+
+create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42 as
+select имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+
+# database, table, field, key, view
+select * from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+
+select TABLE_NAME from information_schema.tables where
+table_schema='test';
+
+select COLUMN_NAME from information_schema.columns where
+table_schema='test';
+
+select INDEX_NAME from information_schema.statistics where
+table_schema='test';
+
+select TABLE_NAME from information_schema.views where
+table_schema='test';
+
+show create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+show create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
+
+# procedure, function, event, trigger
+
+create event имÑ_ÑобытиÑ_в_кодировке_утф8_длиной_больше_чем_48 on schedule every 2 year do select 1;
+select EVENT_NAME from information_schema.events
+where event_schema='test';
+drop event имÑ_ÑобытиÑ_в_кодировке_утф8_длиной_больше_чем_48;
+--error 1059
+create event
+очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66
+on schedule every 2 year do select 1;
+
+create trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49
+before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
+select TRIGGER_NAME from information_schema.triggers where
+trigger_schema='test';
+drop trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49;
+--error 1059
+create trigger
+очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66
+before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
+--error 1059
+drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66;
+
+create procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
+begin
+end;
+select ROUTINE_NAME from information_schema.routines where
+routine_schema='test';
+drop procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
+--error 1059
+create procedure очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
+begin
+end;
+
+create function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49()
+ returns int
+return 0;
+select ROUTINE_NAME from information_schema.routines where
+routine_schema='test';
+drop function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49;
+--error 1059
+create function очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
+ returns int
+return 0;
+
+drop view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
+drop table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+set names default;
+--echo End of 5.1 tests
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
index 9111c4ad369..3e20e123258 100644
--- a/mysql-test/t/ctype_cp932_binlog_stm.test
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
@@ -22,7 +22,7 @@ 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 406|
+SHOW BINLOG EVENTS FROM 410|
delimiter ;|
# End of 5.0 tests
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
index 3e49b9de883..64349bc40a6 100644
--- a/mysql-test/t/ctype_uca.test
+++ b/mysql-test/t/ctype_uca.test
@@ -475,3 +475,13 @@ ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
DROP TABLE t1;
+
+#
+# Bug #27079 Crash while grouping empty ucs2 strings
+#
+CREATE TABLE t1 (
+ c1 text character set ucs2 collate ucs2_polish_ci NOT NULL
+) ENGINE=MyISAM;
+insert into t1 values (''),('a');
+SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 5a3720dc431..c3320159c41 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -573,6 +573,20 @@ drop table t1;
deallocate prepare stmt;
#
+# Bug#22638 SOUNDEX broken for international characters
+#
+set names latin1;
+set character_set_connection=ucs2;
+select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
+select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb'));
+select 'mood' sounds like 'mud';
+# Cyrillic A, BE, VE
+select hex(soundex(_ucs2 0x041004110412));
+# Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter
+select hex(soundex(_ucs2 0x00BF00C0));
+set names latin1;
+
+#
# Bug #14290: character_maximum_length for text fields
#
create table t1(a blob, b text charset utf8, c text charset ucs2);
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 47a43258be1..7db651a2a24 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -702,6 +702,14 @@ select * from t1 where soundex(a) = soundex('TEST');
select * from t1 where soundex(a) = soundex('test');
drop table t1;
+#
+# Bug#22638 SOUNDEX broken for international characters
+#
+select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB);
+select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB));
+select soundex(_utf8 0xD091D092D093);
+select hex(soundex(_utf8 0xD091D092D093));
+
SET collation_connection='utf8_general_ci';
-- source include/ctype_filesort.inc
@@ -1186,6 +1194,41 @@ SELECT DISTINCT id FROM t1 ORDER BY id;
DROP TABLE t1;
#
+# Bug#20095 Changing length of VARCHAR field with UTF8
+# collation does not truncate values
+#
+create table t1 (
+ a varchar(26) not null
+) default character set utf8;
+insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
+select * from t1;
+# varchar to varchar
+alter table t1 change a a varchar(20) character set utf8 not null;
+select * from t1;
+# varchar to char
+alter table t1 change a a char(15) character set utf8 not null;
+select * from t1;
+# char to char
+alter table t1 change a a char(10) character set utf8 not null;
+select * from t1;
+# char to varchar
+alter table t1 change a a varchar(5) character set utf8 not null;
+select * from t1;
+drop table t1;
+
+#
+# Check that do_varstring2_mb produces a warning
+#
+create table t1 (
+ a varchar(4000) not null
+) default character set utf8;
+insert into t1 values (repeat('a',4000));
+alter table t1 change a a varchar(3000) character set utf8 not null;
+select length(a) from t1;
+drop table t1;
+
+
+#
# Bug#10504: Character set does not support traditional mode
# Bug#14146: CHAR(...USING ...) and CONVERT(CHAR(...) USING...)
# produce different results
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index 64bd69c1855..fe39cd95753 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -132,6 +132,8 @@ create table t1 (date char(30), format char(30) not null);
insert into t1 values
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
+('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
+('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test
index 3ccee525d10..a44288da9ec 100644
--- a/mysql-test/t/delayed.test
+++ b/mysql-test/t/delayed.test
@@ -234,3 +234,21 @@ SET @@session.auto_increment_offset=
SET @@session.auto_increment_increment=
@bug20830_old_session_auto_increment_increment;
+#
+# BUG#26238 - inserted delayed always inserts 0 for BIT columns
+#
+CREATE TABLE t1(a BIT);
+INSERT DELAYED INTO t1 VALUES(1);
+FLUSH TABLE t1;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+#
+# Bug#26464 - insert delayed + update + merge = corruption
+#
+CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
+CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1);
+--error 1031
+INSERT DELAYED INTO t2 VALUES(1);
+DROP TABLE t1, t2;
+
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 306447dbd5a..36d627209db 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -203,3 +203,21 @@ select * from t1 where a is null;
delete from t1 where a is null;
select count(*) from t1;
drop table t1;
+
+#
+# Bug #26186: delete order by, sometimes accept unknown column
+#
+CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1);
+
+--error ER_BAD_FIELD_ERROR
+DELETE FROM t1 ORDER BY x;
+
+# even columns from a table not used in query (and not even existing)
+--error ER_BAD_FIELD_ERROR
+DELETE FROM t1 ORDER BY t2.x;
+
+# subquery (as long as the subquery from is valid or DUAL)
+--error ER_BAD_FIELD_ERROR
+DELETE FROM t1 ORDER BY (SELECT x);
+
+DROP TABLE t1;
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 769c9ab1512..57c3e1b7aba 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -12,22 +12,22 @@
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
+im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
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
-ndb_restore_partition : Problem with cluster/def/schema table that is in std_data/ndb_backup51; Pekka will schdule this to someone
-rpl_ndb_sync : Problem with cluster/def/schema table that is in std_data/ndb_backup51; Pekka will schdule this to someone
partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
+rpl_ndb_circular_simplex : BUG#27972 2007-04-20 mats Slave cannot start where it stopped
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_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master
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_multi_engine : BUG#22583 2006-09-23 lars
+#rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
+rpl_udf : BUG#27564 2007-03-31 lars New test case for rpl of UDF shows valgrind failure
synchronization : Bug#24529 Test 'synchronization' fails on Mac pushbuild; Also on Linux 64 bit.
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
@@ -37,4 +37,6 @@ synchronization : Bug#24529 Test 'synchronization' fails on Mac pushb
plugin : Bug#25659 memory leak via "plugins" test
rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly
-ndb_alter_table : Bug##25774 ndb_alter_table.test fails in DBUG_ASSERT() on Linux x64
+
+rpl_ndb_stm_innodb : Bug#26783
+ndb_partition_error2 : HF is not sure if the test can work as internded on all the platforms
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 476e4ce7735..7310f98cd16 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -540,3 +540,16 @@ EXPLAIN SELECT a FROM t1 GROUP BY a;
SELECT a FROM t1 GROUP BY a;
DROP TABLE t1;
+
+#
+#Bug #27659: SELECT DISTINCT returns incorrect result set when field is
+#repeated
+#
+#
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES(1,1),(1,2),(1,3);
+SELECT DISTINCT a, b FROM t1;
+SELECT DISTINCT a, a, b FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/endspace.test b/mysql-test/t/endspace.test
index c4d53450910..b223c683cde 100644
--- a/mysql-test/t/endspace.test
+++ b/mysql-test/t/endspace.test
@@ -16,7 +16,8 @@ drop table if exists t1;
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
check table t1;
-select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+select * from t1 ignore key (key1) where text1='teststring' or
+ text1 like 'teststring_%' ORDER BY text1;
select * from t1 where text1='teststring' or text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 > 'teststring\t';
select * from t1 order by text1;
@@ -24,7 +25,8 @@ explain select * from t1 order by text1;
alter table t1 modify text1 char(32) binary not null;
check table t1;
-select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+select * from t1 ignore key (key1) where text1='teststring' or
+ text1 like 'teststring_%' ORDER BY text1;
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
select text1, length(text1) from t1 order by text1;
@@ -57,7 +59,8 @@ drop table t1;
create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap;
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
-select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+select * from t1 ignore key (key1) where text1='teststring' or
+ text1 like 'teststring_%' ORDER BY text1;
select * from t1 where text1='teststring' or text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 >= 'teststring\t';
select * from t1 order by text1;
diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test
index f5647a293e8..4fbdcba635f 100644
--- a/mysql-test/t/errors.test
+++ b/mysql-test/t/errors.test
@@ -40,5 +40,17 @@ create table t1 (a int(256));
set sql_mode='traditional';
--error 1074
create table t1 (a varchar(66000));
+set sql_mode=default;
+
+#
+# Bug #27513: mysql 5.0.x + NULL pointer DoS
+#
+CREATE TABLE t1 (a INT);
+SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
+INSERT INTO t1 VALUES(1);
+SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
+INSERT INTO t1 VALUES(2),(3);
+SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
+DROP TABLE t1;
# End of 5.0 tests
diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test
index 6eb514fc13c..575f9984a79 100644
--- a/mysql-test/t/events.test
+++ b/mysql-test/t/events.test
@@ -1,7 +1,13 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
-create database if not exists events_test;
+--disable_warnings
+drop database if exists events_test;
+drop database if exists db_x;
+drop database if exists mysqltest_db2;
+drop database if exists mysqltest_no_such_database;
+--enable_warnings
+create database events_test;
use events_test;
#
@@ -74,7 +80,7 @@ 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
+--error ER_EVENT_RECURSION_FORBIDDEN
alter event e_43 do alter event e_43 do set @a = 4;
delimiter |;
alter event e_43 do
@@ -122,45 +128,64 @@ 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;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root6;
create event root7 on schedule every 2 year do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root7;
create event root8 on schedule every '2:5' year_month do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root8;
create event root8_1 on schedule every '2:15' year_month do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root8_1;
create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root9;
create event root10 on schedule every '20:5' day_hour do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root10;
create event root11 on schedule every '20:25' day_hour do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root11;
create event root12 on schedule every '20:25' hour_minute do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root12;
create event root13 on schedule every '25:25' hour_minute do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root13;
create event root13_1 on schedule every '11:65' hour_minute do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root13_1;
create event root14 on schedule every '35:35' minute_second do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root14;
create event root15 on schedule every '35:66' minute_second do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root15;
create event root16 on schedule every '35:56' day_minute do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root16;
create event root17 on schedule every '35:12:45' day_minute do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root17;
create event root17_1 on schedule every '35:25:65' day_minute do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root17_1;
create event root18 on schedule every '35:12:45' hour_second do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root18;
create event root19 on schedule every '15:59:85' hour_second do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root19;
create event root20 on schedule every '50:20:12:45' day_second do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT root20;
set names cp1251;
create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåíòàð' do select 1;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT ðóóò21;
-insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND");
+insert into mysql.event (db, name, body, definer, interval_value, interval_field, originator) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND", 1);
--error ER_NOT_SUPPORTED_YET
show create event root22;
--error ER_NOT_SUPPORTED_YET
@@ -196,62 +221,161 @@ set names latin1;
#
#
-# mysql.event intact checking start
+# mysql.event intact checking
+# Check that the server does not crash if
+# one has destroyed or tampered with the event table.
+# Please see see for events_restart_phase* tests to
+# see the server behavior at start up with bad mysql.event
+# table.
#
-# There should be at least 1 second between the ALTERs or we can't catch the change of create_time!!
+#
+--echo Create a test event. Only event metadata is relevant,
+--echo the actual schedule and body are not.
#
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;
+#
+--echo Try to alter mysql.event: the server should fail to load
+--echo event information after mysql.event was tampered with.
+--echo
+--echo First, let's add a column to the end and make sure everything
+--echo works as before
+--echo
+ALTER TABLE mysql.event ADD dummy INT;
--replace_column 8 # 9 #
SHOW EVENTS;
+SELECT event_name FROM INFORMATION_SCHEMA.events;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
+SHOW CREATE EVENT intact_check;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT no_such_event;
+CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+ALTER EVENT intact_check_1 RENAME TO intact_check_2;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT intact_check_1;
+DROP EVENT intact_check_2;
+DROP EVENT intact_check;
+DROP DATABASE IF EXISTS mysqltest_no_such_database;
+CREATE DATABASE mysqltest_db2;
+DROP DATABASE mysqltest_db2;
+SELECT @@event_scheduler;
+SHOW VARIABLES LIKE 'event_scheduler';
+SET GLOBAL event_scheduler=OFF;
+# Clean up
+ALTER TABLE mysql.event DROP dummy;
+CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
+--echo
+--echo Now let's add a column to the first position: the server
+--echo expects to see event schema name there
+--echo
+ALTER TABLE mysql.event ADD dummy INT FIRST;
+--error ER_CANNOT_LOAD_FROM_TABLE
+SHOW EVENTS;
+--error ER_CANNOT_LOAD_FROM_TABLE
+SELECT event_name FROM INFORMATION_SCHEMA.events;
+--error ER_EVENT_DOES_NOT_EXIST
+SHOW CREATE EVENT intact_check;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT no_such_event;
+--error ER_CANNOT_LOAD_FROM_TABLE
+CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+--error ER_EVENT_DOES_NOT_EXIST
+ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+--error ER_EVENT_DOES_NOT_EXIST
+ALTER EVENT intact_check_1 RENAME TO intact_check_2;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT intact_check_1;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT intact_check_2;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT intact_check;
+# Should work OK
+DROP DATABASE IF EXISTS mysqltest_no_such_database;
+CREATE DATABASE mysqltest_db2;
+DROP DATABASE mysqltest_db2;
+SELECT @@event_scheduler;
+SHOW VARIABLES LIKE 'event_scheduler';
+SET GLOBAL event_scheduler=OFF;
+--echo Clean up
+ALTER TABLE mysql.event DROP dummy;
+DELETE FROM mysql.event;
+CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
+--echo Back up the table, further changes are not reversible
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;
+--echo
+--echo Drop some columns and try more checks.
+--echo
+--echo
+ALTER TABLE mysql.event DROP comment, DROP starts;
--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
+SHOW CREATE EVENT intact_check;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT no_such_event;
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
-SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+--error ER_EVENT_DOES_NOT_EXIST
+ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+--error ER_EVENT_DOES_NOT_EXIST
+ALTER EVENT intact_check_1 RENAME TO intact_check_2;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT intact_check_1;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT intact_check_2;
+# Should succeed
+DROP EVENT intact_check;
+DROP DATABASE IF EXISTS mysqltest_no_such_database;
+CREATE DATABASE mysqltest_db2;
+DROP DATABASE mysqltest_db2;
+SELECT @@event_scheduler;
+SHOW VARIABLES LIKE 'event_scheduler';
+SET GLOBAL event_scheduler=OFF;
+--echo
+--echo Now drop the table, and test again
+--echo
+--echo
DROP TABLE mysql.event;
+--error ER_NO_SUCH_TABLE
+SHOW EVENTS;
+--error ER_NO_SUCH_TABLE
+SELECT event_name FROM INFORMATION_SCHEMA.events;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE EVENT intact_check;
+--error ER_NO_SUCH_TABLE
+DROP EVENT no_such_event;
+--error ER_NO_SUCH_TABLE
+CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+--error ER_NO_SUCH_TABLE
+ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+--error ER_NO_SUCH_TABLE
+ALTER EVENT intact_check_1 RENAME TO intact_check_2;
+--error ER_NO_SUCH_TABLE
+DROP EVENT intact_check_1;
+--error ER_NO_SUCH_TABLE
+DROP EVENT intact_check_2;
+--error ER_NO_SUCH_TABLE
+DROP EVENT intact_check;
+DROP DATABASE IF EXISTS mysqltest_no_such_database;
+CREATE DATABASE mysqltest_db2;
+DROP DATABASE mysqltest_db2;
+--echo OK, there is an unnecessary warning about the non-existent table
+--echo but it's not easy to fix and no one complained about it.
+--echo A similar warning is printed if mysql.proc is missing.
+SHOW WARNINGS;
+SELECT @@event_scheduler;
+SHOW VARIABLES LIKE 'event_scheduler';
+SET GLOBAL event_scheduler=OFF;
+--echo Restore the original table.
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
#
@@ -332,7 +456,7 @@ 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
+--error ER_EVENT_RECURSION_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;
#
@@ -405,5 +529,200 @@ SHOW EVENTS FROM aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
SHOW EVENTS FROM ``;
SHOW EVENTS FROM `events\\test`;
+#
+# A check for events SQL under LOCK TABLES and in pre-locked mode.
+#
+--echo
+--echo LOCK TABLES mode.
+--echo
+#
+# SHOW CREATE EVENT and INFORMATION_SCHEMA.events are available and
+# cause an implicit lock/unlock of mysql.event table, regardless of the
+# currently locked tables.
+#
+create table t1 (a int);
+create event e1 on schedule every 10 hour do select 1;
+#
+lock table t1 read;
+#
+--replace_regex /STARTS '[^']+'/STARTS '#'/
+show create event e1;
+select event_name from information_schema.events;
+--error ER_TABLE_NOT_LOCKED
+create event e2 on schedule every 10 hour do select 1;
+--error ER_TABLE_NOT_LOCKED
+alter event e2 disable;
+--error ER_TABLE_NOT_LOCKED
+alter event e2 rename to e3;
+--error ER_TABLE_NOT_LOCKED
+drop event e2;
+--error ER_TABLE_NOT_LOCKED
+drop event e1;
+unlock tables;
+#
+lock table t1 write;
+#
+--replace_regex /STARTS '[^']+'/STARTS '#'/
+show create event e1;
+select event_name from information_schema.events;
+--error ER_TABLE_NOT_LOCKED
+create event e2 on schedule every 10 hour do select 1;
+--error ER_TABLE_NOT_LOCKED
+alter event e2 disable;
+--error ER_TABLE_NOT_LOCKED
+alter event e2 rename to e3;
+--error ER_TABLE_NOT_LOCKED
+drop event e2;
+--error ER_TABLE_NOT_LOCKED
+drop event e1;
+unlock tables;
+#
+lock table t1 read, mysql.event read;
+#
+--replace_regex /STARTS '[^']+'/STARTS '#'/
+show create event e1;
+select event_name from information_schema.events;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+create event e2 on schedule every 10 hour do select 1;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter event e2 disable;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter event e2 rename to e3;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+drop event e2;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+drop event e1;
+unlock tables;
+#
+lock table t1 write, mysql.event read;
+#
+--replace_regex /STARTS '[^']+'/STARTS '#'/
+show create event e1;
+select event_name from information_schema.events;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+create event e2 on schedule every 10 hour do select 1;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter event e2 disable;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter event e2 rename to e3;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+drop event e2;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+drop event e1;
+unlock tables;
+#
+--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
+lock table t1 read, mysql.event write;
+#
+--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
+lock table t1 write, mysql.event write;
+#
+lock table mysql.event write;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
+show create event e1;
+select event_name from information_schema.events;
+create event e2 on schedule every 10 hour do select 1;
+alter event e2 disable;
+alter event e2 rename to e3;
+drop event e3;
+drop event e1;
+unlock tables;
+--echo Make sure we have left no events
+select event_name from information_schema.events;
+--echo
+--echo Events in sub-statements, events and prelocking
+--echo
+--echo
+create event e1 on schedule every 10 hour do select 1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function f1() returns int
+begin
+ show create event e1;
+ return 1;
+end|
+--error ER_SP_NO_RETSET
+create trigger trg before insert on t1 for each row
+begin
+ show create event e1;
+end|
+--error ER_SP_NO_RETSET
+create function f1() returns int
+begin
+ select event_name from information_schema.events;
+ return 1;
+end|
+--error ER_SP_NO_RETSET
+create trigger trg before insert on t1 for each row
+begin
+ select event_name from information_schema.events;
+end|
+--error ER_EVENT_RECURSION_FORBIDDEN
+create function f1() returns int
+begin
+ create event e2 on schedule every 10 hour do select 1;
+ return 1;
+end|
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create function f1() returns int
+begin
+ alter event e1 rename to e2;
+ return 1;
+end|
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create function f1() returns int
+begin
+ drop event e2;
+ return 1;
+end|
+--echo ----------------------------------------------------------------------
+create trigger trg before insert on t1 for each row
+begin
+ set new.a= f1();
+end|
+create function f1() returns int
+begin
+ call p1();
+ return 0;
+end|
+create procedure p1()
+begin
+ select event_name from information_schema.events;
+end|
+--error ER_SP_NO_RETSET
+insert into t1 (a) values (1)|
+drop procedure p1|
+create procedure p1()
+begin
+ show create event e1;
+end|
+--error ER_SP_NO_RETSET
+insert into t1 (a) values (1)|
+drop procedure p1|
+create procedure p1()
+begin
+ create temporary table tmp select event_name from information_schema.events;
+end|
+--echo expected to work, since we redirect the output into a tmp table
+insert into t1 (a) values (1)|
+select * from tmp|
+drop temporary table tmp|
+drop procedure p1|
+create procedure p1()
+begin
+ alter event e1 rename to e2;
+end|
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+insert into t1 (a) values (1)|
+drop procedure p1|
+create procedure p1()
+begin
+ drop event e1;
+end|
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+insert into t1 (a) values (1)|
+drop table t1|
+drop event e1|
+delimiter ;|
drop database events_test;
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index 0790999d720..8343c6b4bc6 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.test
@@ -1,7 +1,12 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
-create database if not exists events_test;
+--disable_warnings
+drop database if exists events_test;
+drop database if exists mysqltest_db1;
+drop database if exists mysqltest_db2;
+--enable_warnings
+create database events_test;
use events_test;
#
@@ -30,7 +35,7 @@ SET NAMES latin1;
# START - BUG#16408: Events: crash for an event in a procedure
#
set @a=3;
---error ER_EVENT_RECURSIVITY_FORBIDDEN
+--error ER_EVENT_RECURSION_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
@@ -45,10 +50,17 @@ create event e_55 on schedule at 99990101000000 do drop table t;
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
+--error ER_WRONG_VALUE
create event e_55 on schedule at 10000101000000 do drop table t;
---error ER_EVENT_EXEC_TIME_IN_THE_PAST
+
+# For the purpose of backup we allow times in the past. Here, no
+# error will be given, but the event won't be created. One may think
+# of that as if the event was created, then it turned out it's in the
+# past, so it was dropped because of implicit ON COMPLETION NOT
+# PRESERVE.
create event e_55 on schedule at 20000101000000 do drop table t;
+show events;
+
--error ER_PARSE_ERROR
create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t;
--error ER_PARSE_ERROR
@@ -422,6 +434,184 @@ DROP USER mysqltest_u1@localhost;
#
+# BUG#16420: Events: timestamps become UTC
+# BUG#26429: SHOW CREATE EVENT is incorrect for an event that
+# STARTS NOW()
+# BUG#26431: Impossible to re-create an event from backup if its
+# STARTS clause is in the past
+# WL#3698: Events: execution in local time zone
+#
+# Here we only check non-concurrent aspects of the patch.
+# For the actual tests of time zones please see events_time_zone.test
+#
+SET GLOBAL EVENT_SCHEDULER= OFF;
+SET @save_time_zone= @@TIME_ZONE;
+
+#----------------------------------------------------------------------
+
+# We will use a separate connection because SET TIMESTAMP will stop
+# the clock in that connection.
+
+SET TIME_ZONE= '+00:00';
+SET TIMESTAMP= UNIX_TIMESTAMP('2005-12-31 23:58:59');
+
+
+# Test when event time zone is updated on ALTER EVENT.
+#
+
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
+SHOW EVENTS;
+
+# Test storing and updating of the event time zone.
+#
+SET TIME_ZONE= '-01:00';
+ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:00';
+SHOW EVENTS;
+
+# This will update event time zone.
+SET TIME_ZONE= '+02:00';
+ALTER EVENT e1 ON SCHEDULE AT '2000-01-02 00:00:00'
+ ON COMPLETION PRESERVE DISABLE;
+SHOW EVENTS;
+
+# This will update event time zone.
+SET TIME_ZONE= '-03:00';
+ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY ENDS '2030-01-03 00:00:00'
+ ON COMPLETION PRESERVE DISABLE;
+SHOW EVENTS;
+
+# This will not update event time zone, as no time is being adjusted.
+SET TIME_ZONE= '+04:00';
+ALTER EVENT e1 DO SELECT 2;
+SHOW EVENTS;
+
+DROP EVENT e1;
+
+#----------------------------------------------------------------------
+
+# Create some events.
+SET TIME_ZONE='+05:00';
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
+ SELECT 1;
+
+SET TIMESTAMP= @@TIMESTAMP + 1;
+
+SET TIME_ZONE='-05:00';
+CREATE EVENT e2 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
+ SELECT 1;
+
+SET TIMESTAMP= @@TIMESTAMP + 1;
+
+SET TIME_ZONE='+00:00';
+CREATE EVENT e3 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
+ SELECT 1;
+
+
+# Test INFORMATION_SCHEMA.EVENTS.
+#
+
+SELECT * FROM INFORMATION_SCHEMA.EVENTS ORDER BY event_name;
+
+
+# Test SHOW EVENTS.
+#
+
+SHOW EVENTS;
+
+
+# Test SHOW CREATE EVENT.
+#
+
+SHOW CREATE EVENT e1;
+SHOW CREATE EVENT e2;
+SHOW CREATE EVENT e3;
+
+#----------------------------------------------------------------------
+
+# Test times in the past.
+#
+
+--echo The following should fail, and nothing should be altered.
+
+--error ER_EVENT_CANNOT_ALTER_IN_THE_PAST
+ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00';
+
+--error ER_EVENT_CANNOT_ALTER_IN_THE_PAST
+ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' DISABLE;
+
+--echo The following should give warnings, and nothing should be created.
+
+CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00'
+DO
+ SELECT 1;
+
+CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' DISABLE
+DO
+ SELECT 1;
+
+CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DO
+ SELECT 1;
+
+CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DISABLE
+DO
+ SELECT 1;
+
+SHOW EVENTS;
+
+--echo The following should succeed giving a warning.
+
+ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE;
+
+CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE
+DO
+ SELECT 1;
+
+CREATE EVENT e5 ON SCHEDULE AT '1999-01-01 00:00:00'
+ ON COMPLETION PRESERVE
+DO
+ SELECT 1;
+
+--echo The following should succeed without warnings.
+
+ALTER EVENT e2 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00';
+
+ALTER EVENT e3 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE;
+
+CREATE EVENT e6 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' DO
+ SELECT 1;
+
+CREATE EVENT e7 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
+ ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE
+DO
+ SELECT 1;
+
+CREATE EVENT e8 ON SCHEDULE AT '1999-01-01 00:00:00'
+ ON COMPLETION PRESERVE DISABLE
+DO
+ SELECT 1;
+
+SHOW EVENTS;
+
+
+DROP EVENT e8;
+DROP EVENT e7;
+DROP EVENT e6;
+DROP EVENT e5;
+DROP EVENT e4;
+DROP EVENT e3;
+DROP EVENT e2;
+DROP EVENT e1;
+
+SET TIME_ZONE=@save_time_zone;
+
+#
# End of tests
#
drop database events_test;
diff --git a/mysql-test/t/events_logs_tests.test b/mysql-test/t/events_logs_tests.test
index 64ce4a5c3df..25b75f13f01 100644
--- a/mysql-test/t/events_logs_tests.test
+++ b/mysql-test/t/events_logs_tests.test
@@ -89,10 +89,12 @@ DROP EVENT long_event;
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
+let $wait_timeout= 30;
+let $wait_condition= SELECT COUNT(*) = 1 FROM mysql.slow_log;
+--source include/wait_condition.inc
--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"
+--echo "Check slow log. Should see 1 row because 2 is over the threshold of 1 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;
diff --git a/mysql-test/t/events_restart_phase0.log b/mysql-test/t/events_restart_phase0.log
deleted file mode 100644
index 218b804a302..00000000000
--- a/mysql-test/t/events_restart_phase0.log
+++ /dev/null
@@ -1,22 +0,0 @@
-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
deleted file mode 100644
index 218b804a302..00000000000
--- a/mysql-test/t/events_restart_phase0.result
+++ /dev/null
@@ -1,22 +0,0 @@
-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
index 92783ddaef7..6a94ef12222 100644
--- a/mysql-test/t/events_restart_phase1.test
+++ b/mysql-test/t/events_restart_phase1.test
@@ -1,19 +1,43 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
+#
+# Test that when the server is restarted, it checks mysql.event table,
+# and disables the scheduler if it's not up to date.
+#
+
+# Switch off the scheduler for now.
+set global event_scheduler=off;
--disable_warnings
-create database if not exists mysqltest_events_test;
+drop database if exists events_test;
--enable_warnings
-
-use mysqltest_events_test;
-set global event_scheduler=off;
+create database events_test;
+use events_test;
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');
+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');
+#
+# There are various conditions when a server would regard mysql.event
+# table as damaged:
+# - the table has more column than specified in the compiled in value, but
+# the version of the server which created the table is the same
+# - the column count in the table is less than the compiled in value
+# - some column has an incompatible type specification (for what is an
+# incompatible type specification please refer to the comments in the source
+#
+# Unfortunately, in order to test a condition, we need to restart the
+# server. Therefore, here we test only one simple case: changing the data
+# type of the 'body' field to blob.
+#
+# First, let's do a backup to not depend on actual definition of mysql.event
+create table event_like like mysql.event;
+insert into event_like select * from mysql.event;
+# Now let's alter the table and restart the server
+alter table mysql.event
+ change column body body longtext character set utf8 collate utf8_bin;
--echo "Now we restart the server"
diff --git a/mysql-test/t/events_restart_phase2.test b/mysql-test/t/events_restart_phase2.test
index 845472377ba..c3f799634b3 100644
--- a/mysql-test/t/events_restart_phase2.test
+++ b/mysql-test/t/events_restart_phase2.test
@@ -1,9 +1,41 @@
# 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"
+use events_test;
+# Event scheduler should be disabled: the system tables are damaged
+select @@event_scheduler;
+# Try various Event Scheduler operation and check the output.
+--error ER_EVENTS_DB_ERROR
+show events;
+--error ER_EVENTS_DB_ERROR
+select event_name from information_schema.events;
+--error ER_EVENTS_DB_ERROR
+show create event intact_check;
+--error ER_EVENTS_DB_ERROR
+drop event no_such_event;
+--error ER_EVENTS_DB_ERROR
+create event intact_check_1 on schedule every 5 hour do select 5;
+--error ER_EVENTS_DB_ERROR
+alter event intact_check_1 on schedule every 8 hour do select 8;
+--error ER_EVENTS_DB_ERROR
+alter event intact_check_1 rename to intact_check_2;
+--error ER_EVENTS_DB_ERROR
+drop event intact_check_1;
+--error ER_EVENTS_DB_ERROR
+drop event intact_check_2;
+--error ER_EVENTS_DB_ERROR
+drop event intact_check;
+--error ER_EVENTS_DB_ERROR
+set global event_scheduler=on;
+--error ER_EVENTS_DB_ERROR
+set global event_scheduler=off;
+show variables like 'event_scheduler';
+--echo Make sure that we still can create and drop databases,
+--echo and no warnings are produced.
+drop database if exists mysqltest_database_not_exists;
+create database mysqltest_db1;
+drop database mysqltest_db1;
+--echo Restore the original mysql.event table
+drop table mysql.event;
+rename table event_like to mysql.event;
+--echo Now let's restart the server again
diff --git a/mysql-test/t/events_restart_phase3.test b/mysql-test/t/events_restart_phase3.test
index 76cd9d22752..1be40c72717 100644
--- a/mysql-test/t/events_restart_phase3.test
+++ b/mysql-test/t/events_restart_phase3.test
@@ -1,14 +1,18 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
-
-use mysqltest_events_test;
---sleep 2
+#
+# We need this file primarily to make sure that the scheduler is restarted
+# and enabled after we have restored mysql.event table.
+# This is the final step of the "cleanup".
+#
+# Make sure also that events are executed OK after restart, just in case.
+use events_test;
+# Make sure the scheduler was started successfully
+select @@event_scheduler;
+let $wait_condition=select count(distinct name)=3 from execution_log;
+--source include/wait_condition.inc
--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;
+# Will drop all events
+drop database events_test;
diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test
index e3b55685e65..31c09a3d561 100644
--- a/mysql-test/t/events_scheduling.test
+++ b/mysql-test/t/events_scheduling.test
@@ -1,17 +1,20 @@
# 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;
+--echo Try agian to make sure it's allowed
+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;
+--echo Try again to make sure it's allowed
+SET GLOBAL event_scheduler=ON;
SHOW VARIABLES LIKE 'event_scheduler';
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL event_scheduler=DISABLED;
@@ -30,34 +33,73 @@ 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
+CREATE EVENT event_1 ON SCHEDULE EVERY 2 SECOND
+DO
+ INSERT INTO table_1 VALUES (1);
+
+CREATE EVENT event_2 ON SCHEDULE EVERY 1 SECOND
+ENDS NOW() + INTERVAL 6 SECOND
+ON COMPLETION PRESERVE
+DO
+ INSERT INTO table_2 VALUES (1);
+
+CREATE EVENT event_3 ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND
+ON COMPLETION NOT PRESERVE
+DO
+ INSERT INTO table_3 VALUES (1);
+
+CREATE EVENT event_4 ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND
+ON COMPLETION PRESERVE
+DO
+ INSERT INTO table_4 VALUES (1);
+
+# Let event_1 insert at least 4 records into the table
+let $wait_condition=select count(*) >= 4 from table_1;
+--source include/wait_condition.inc
+
+# Let event_2 reach the end of its execution interval
+let $wait_condition=select count(*) = 0 from information_schema.events
+where event_name='event_2' and status='enabled';
+--source include/wait_condition.inc
+
+# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
+let $wait_condition=select count(*) = 0 from information_schema.events
+where event_name='event_3';
+--source include/wait_condition.inc
+
+# Let event_4 reach the end of its execution interval
+let $wait_condition=select count(*) = 0 from information_schema.events
+where event_name='event_4' and status='enabled';
+--source include/wait_condition.inc
+
+# check the data
+
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;
+SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3;
+SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_4;
+
+SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR')
+FROM INFORMATION_SCHEMA.EVENTS
+WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2';
+
+SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR')
+FROM INFORMATION_SCHEMA.EVENTS
+WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2';
+
--echo "Already dropped because ended. Therefore an error."
--error ER_EVENT_DOES_NOT_EXIST
-DROP EVENT only_one_time;
+DROP EVENT event_3;
+
+DROP EVENT event_1;
--echo "Should be preserved"
SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_NAME;
-DROP EVENT two_time;
+DROP EVENT event_2;
+DROP EVENT event_4;
DROP TABLE table_1;
DROP TABLE table_2;
DROP TABLE table_3;
diff --git a/mysql-test/t/events_time_zone.test b/mysql-test/t/events_time_zone.test
new file mode 100644
index 00000000000..5f929e0b07a
--- /dev/null
+++ b/mysql-test/t/events_time_zone.test
@@ -0,0 +1,294 @@
+# This test case is sensitive to execution timing. You may control
+# this sensitivity by the parameter below. Small values will result
+# in fast but more unstable execution, large values will improve
+# stability at the cost of speed. Basically, N is a number of seconds
+# to wait for operation to complete. Should be positive. Test runs
+# about 25*N seconds (it sleeps most of the time, so CPU speed is not
+# relevant).
+let $N = 5;
+
+--source include/big_test.inc
+
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest_db1;
+--enable_warnings
+
+CREATE DATABASE mysqltest_db1;
+
+let $old_db= `SELECT DATABASE()`;
+USE mysqltest_db1;
+
+SET GLOBAL EVENT_SCHEDULER= OFF;
+SET @save_time_zone= @@TIME_ZONE;
+
+
+#
+# BUG#16420: Events: timestamps become UTC
+# BUG#26429: SHOW CREATE EVENT is incorrect for an event that
+# STARTS NOW()
+# BUG#26431: Impossible to re-create an event from backup if its
+# STARTS clause is in the past
+# WL#3698: Events: execution in local time zone
+#
+
+#----------------------------------------------------------------------
+
+# Create rounding function.
+
+# Disable query log to hide actual value of $N.
+--disable_query_log
+eval SET @step= $N;
+--enable_query_log
+
+# Since we are working in a separate database, we may use any names we
+# like.
+CREATE TABLE t_step (step INT);
+INSERT INTO t_step VALUES (@step);
+
+# We can't use @variables in function, because it will be called from
+# the event thread, and 'eval' doesn't work for multi-statements, so
+# we can't interpolate $variables either, hence we fetch the step
+# value from the table.
+delimiter //;
+CREATE FUNCTION round_to_step(i INT, n INT) RETURNS INT
+BEGIN
+ DECLARE step INT;
+
+ SELECT * INTO step FROM t_step;
+
+ # We add 0.1 as a protection from inexact division.
+ RETURN FLOOR((i % (step * n) + 0.1) / step);
+END//
+delimiter ;//
+
+
+# Test time computations wrt Daylight Saving Time shifts. We also
+# test here that the event operates in its time zone (see what NOW()
+# returns).
+#
+
+# Create a fake time zone with time transitions every 3*$N second.
+
+SET @step3= @step * 3;
+SET @step6= @step * 6;
+
+# Disable query log to hide current time.
+--disable_query_log
+SET @unix_time= UNIX_TIMESTAMP() - 1;
+--enable_query_log
+
+SET @unix_time= @unix_time - @unix_time % @step6;
+
+INSERT INTO mysql.time_zone VALUES (NULL, 'N');
+SET @tzid= LAST_INSERT_ID();
+INSERT INTO mysql.time_zone_transition_type
+ VALUES (@tzid, 0, 0, 0, 'b16420_0');
+INSERT INTO mysql.time_zone_transition_type
+ VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
+
+let $transition_unix_time= `SELECT @unix_time`;
+let $count= 30;
+--disable_query_log
+while ($count)
+{
+ eval INSERT INTO mysql.time_zone_transition
+ VALUES (@tzid, $transition_unix_time,
+ $transition_unix_time % @step6 = 0);
+ let $transition_unix_time= `SELECT $transition_unix_time + @step3`;
+ dec $count;
+}
+--enable_query_log
+INSERT INTO mysql.time_zone_name VALUES ('bug16420', @tzid);
+
+CREATE TABLE t1 (count INT, unix_time INT, local_time INT, comment CHAR(80));
+CREATE TABLE t2 (count INT);
+INSERT INTO t2 VALUES (1);
+
+delimiter //;
+CREATE FUNCTION f1(comment CHAR(80)) RETURNS INT
+BEGIN
+ DECLARE orig_tz CHAR(64);
+ DECLARE unix_time INT;
+ DECLARE local_now DATETIME;
+ DECLARE utc_now DATETIME;
+ DECLARE local_time INT;
+
+ SET unix_time= UNIX_TIMESTAMP();
+ SET local_now= FROM_UNIXTIME(unix_time);
+ SET orig_tz= @@TIME_ZONE;
+ SET TIME_ZONE = '+00:00';
+ SET utc_now= FROM_UNIXTIME(unix_time);
+ SET TIME_ZONE= orig_tz;
+ SET local_time = unix_time + TIMESTAMPDIFF(SECOND, utc_now, local_now);
+
+ SET unix_time= round_to_step(unix_time, 6);
+ SET local_time= round_to_step(local_time, 6);
+
+ INSERT INTO t1 VALUES ((SELECT count FROM t2),
+ unix_time, local_time, comment);
+ RETURN 0;
+END//
+delimiter ;//
+
+SET TIME_ZONE= '+00:00';
+CREATE EVENT e1 ON SCHEDULE EVERY @step SECOND
+ STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e1>");
+
+SET TIME_ZONE= 'bug16420';
+CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
+ STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e2>");
+
+# We want to start at the beginning of the DST cycle, so we wait
+# untill current time divides by @step6.
+let $wait_timeout= `SELECT @step6 + 1`;
+let $wait_condition= SELECT UNIX_TIMESTAMP() % @step6 = @step6 - 1;
+--source include/wait_condition.inc
+# The second wait is needed because after the first wait we may end up
+# on the ending edge of a second. Second wait will bring us to the
+# beginning edge.
+let $wait_timeout= `SELECT @step + 1`;
+let $wait_condition= SELECT UNIX_TIMESTAMP() % @step6 = 0;
+--source include/wait_condition.inc
+
+# Note that after the scheduler is enabled, the event will be
+# scheduled only for the next second.
+SET GLOBAL EVENT_SCHEDULER= ON;
+
+# We want to run after the events are executed.
+SELECT SLEEP(@step / 2);
+
+let $count= 7;
+--disable_query_log
+--disable_result_log
+while ($count)
+{
+ SELECT SLEEP(@step);
+
+ eval SELECT CASE $count
+ WHEN 5 THEN f1(CONCAT("Second pass after backward -2 step shift,",
+ " e2 should not be executed"))
+ WHEN 4 THEN f1(CONCAT("Second pass after backward -2 step shift,",
+ " e2 should not be executed"))
+ WHEN 2 THEN f1(CONCAT("Forward +2 step shift, local 0, 1 are skipped,",
+ " e2 should be executed"))
+ ELSE f1("e2 should be executed")
+ END;
+ UPDATE t2 SET count= count + 1;
+
+ dec $count;
+}
+--enable_result_log
+--enable_query_log
+
+SET GLOBAL EVENT_SCHEDULER= OFF;
+
+SELECT * FROM t1 ORDER BY count, comment;
+
+SET TIME_ZONE= @save_time_zone;
+
+DROP EVENT e2;
+DROP EVENT e1;
+DROP FUNCTION f1;
+DROP TABLE t1, t2;
+
+DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
+
+#----------------------------------------------------------------------
+
+# Test MONTH interval.
+#
+
+SET TIME_ZONE= '+00:00';
+
+CREATE TABLE t1 (event CHAR(2), dt DATE, offset INT);
+
+INSERT INTO mysql.time_zone VALUES (NULL, 'N');
+SET @tzid= LAST_INSERT_ID();
+
+SET @now= UNIX_TIMESTAMP();
+SET @offset_month_01= UNIX_TIMESTAMP('2030-01-31 12:00:00') - @now;
+SET @offset_month_02= UNIX_TIMESTAMP('2030-02-28 12:00:00') - @now - 5*@step;
+SET @offset_month_03= UNIX_TIMESTAMP('2030-03-31 12:00:00') - @now - 5*@step;
+SET @offset_month_04= UNIX_TIMESTAMP('2030-04-30 12:00:00') - @now - 13*@step;
+
+INSERT INTO mysql.time_zone_transition_type
+ VALUES (@tzid, 0, @offset_month_01, 0, 'b16420_0');
+INSERT INTO mysql.time_zone_transition_type
+ VALUES (@tzid, 1, @offset_month_02, 1, 'b16420_1');
+INSERT INTO mysql.time_zone_transition_type
+ VALUES (@tzid, 2, @offset_month_03, 1, 'b16420_2');
+INSERT INTO mysql.time_zone_transition_type
+ VALUES (@tzid, 3, @offset_month_04, 1, 'b16420_3');
+INSERT INTO mysql.time_zone_transition
+ VALUES (@tzid, @now, 0);
+INSERT INTO mysql.time_zone_transition
+ VALUES (@tzid, @now + 3 * @step, 1);
+INSERT INTO mysql.time_zone_transition
+ VALUES (@tzid, @now + 7 * @step, 2);
+INSERT INTO mysql.time_zone_transition
+ VALUES (@tzid, @now + 12 * @step, 3);
+# We have to user a new time zone name, because 'bug16420' has been
+# cached already.
+INSERT INTO mysql.time_zone_name VALUES ('bug16420_2', @tzid);
+
+SET TIME_ZONE= 'bug16420_2';
+
+SET GLOBAL EVENT_SCHEDULER= ON;
+
+let $now= `SELECT @now`;
+--disable_query_log
+eval CREATE EVENT e1 ON SCHEDULE EVERY 1 MONTH
+ STARTS FROM_UNIXTIME($now - @step) DO
+ INSERT INTO t1 VALUES
+ ("e1", NOW(), round_to_step(UNIX_TIMESTAMP() - $now, 4) - 1);
+eval CREATE EVENT e2 ON SCHEDULE EVERY 1 MONTH
+ STARTS FROM_UNIXTIME($now + @step) DO
+ INSERT INTO t1 VALUES
+ ("e2", NOW(), round_to_step(UNIX_TIMESTAMP() - $now, 4) - 1);
+--enable_query_log
+
+let $wait_timeout= `SELECT 16 * @step`;
+let $wait_condition= SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+SET GLOBAL EVENT_SCHEDULER= OFF;
+
+--echo Below we should see the following:
+--echo - On Jan 31 only e2 is executed, because we started later than
+--echo e1 should have been executed. Offset of e2 is 0 because of
+--echo the late start, not 1.
+--echo - The next execution is on Feb 28 (last day of Feb). Both events
+--echo are executed in their times, offsets are -1 and 1.
+--echo - The next time is Mar 31. Because the time of event
+--echo execution was skipped over, events are executed right away,
+--echo offsets are 2 and 2.
+--echo - The next time is Apr 30. Events are again executed in their
+--echo appointed times, offsets are -1 and 1.
+SELECT * FROM t1 ORDER BY dt, event;
+
+DROP EVENT e2;
+DROP EVENT e1;
+DROP TABLE t1;
+
+SET TIME_ZONE= @save_time_zone;
+
+DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
+DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
+
+DROP FUNCTION round_to_step;
+DROP TABLE t_step;
+
+
+DROP DATABASE mysqltest_db1;
+--disable_query_log
+eval USE $old_db;
+--enable_query_log
+
+
+--echo End of 5.1 tests.
diff --git a/mysql-test/t/events_trans.test b/mysql-test/t/events_trans.test
new file mode 100644
index 00000000000..77427070cbb
--- /dev/null
+++ b/mysql-test/t/events_trans.test
@@ -0,0 +1,115 @@
+#
+# Tests that require transactions
+#
+-- source include/have_innodb.inc
+--disable_warnings
+drop database if exists events_test;
+drop database if exists mysqltest_no_such_database;
+--enable_warnings
+create database events_test;
+use events_test;
+
+--echo
+--echo Test that Events DDL issue an implicit COMMIT
+--echo
+--echo
+set autocommit=off;
+# Sanity check
+select @@autocommit;
+create table t1 (a varchar(255)) engine=innodb;
+# Basic: check that successful Events DDL commits pending transaction
+begin work;
+insert into t1 (a) values ("OK: create event");
+create event e1 on schedule every 1 day do select 1;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+#
+begin work;
+insert into t1 (a) values ("OK: alter event");
+alter event e1 on schedule every 2 day do select 2;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+#
+begin work;
+insert into t1 (a) values ("OK: alter event rename");
+alter event e1 rename to e2;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+#
+begin work;
+insert into t1 (a) values ("OK: drop event");
+drop event e2;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+#
+begin work;
+insert into t1 (a) values ("OK: drop event if exists");
+drop event if exists e2;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+#
+create event e1 on schedule every 1 day do select 1;
+begin work;
+insert into t1 (a) values ("OK: create event if not exists");
+create event if not exists e1 on schedule every 2 day do select 2;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+--echo
+--echo Now check various error conditions: make sure we issue an
+--echo implicit commit anyway
+--echo
+#
+begin work;
+insert into t1 (a) values ("OK: create event: event already exists");
+--error ER_EVENT_ALREADY_EXISTS
+create event e1 on schedule every 2 day do select 2;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+#
+begin work;
+insert into t1 (a) values ("OK: alter event rename: rename to same name");
+--error ER_EVENT_SAME_NAME
+alter event e1 rename to e1;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+#
+create event e2 on schedule every 3 day do select 3;
+begin work;
+insert into t1 (a) values ("OK: alter event rename: destination exists");
+--error ER_EVENT_ALREADY_EXISTS
+alter event e2 rename to e1;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+#
+begin work;
+insert into t1 (a) values ("OK: create event: database does not exist");
+--error ER_BAD_DB_ERROR
+create event mysqltest_no_such_database.e1 on schedule every 1 day do select 1;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+
+#
+# Cleanup
+#
+drop database events_test;
+
diff --git a/mysql-test/t/events_trans_notembedded.test b/mysql-test/t/events_trans_notembedded.test
new file mode 100644
index 00000000000..adc293d7e79
--- /dev/null
+++ b/mysql-test/t/events_trans_notembedded.test
@@ -0,0 +1,61 @@
+#
+# Tests that require transactions
+#
+-- source include/not_embedded.inc
+-- source include/have_innodb.inc
+--disable_warnings
+drop database if exists events_test;
+drop database if exists mysqltest_db2;
+--enable_warnings
+create database events_test;
+use events_test;
+
+#
+# Privilege checks
+#
+grant create, insert, select, delete on mysqltest_db2.*
+ to mysqltest_user1@localhost;
+create database mysqltest_db2;
+connect (conn1,localhost,mysqltest_user1,,mysqltest_db2);
+set autocommit=off;
+# Sanity check
+select @@autocommit;
+create table t1 (a varchar(255)) engine=innodb;
+# Not enough privileges to CREATE EVENT
+begin work;
+insert into t1 (a) values ("OK: create event: insufficient privileges");
+--error ER_DBACCESS_DENIED_ERROR
+create event e1 on schedule every 1 day do select 1;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+# Not enough privileges to ALTER EVENT
+begin work;
+insert into t1 (a) values ("OK: alter event: insufficient privileges");
+--error ER_DBACCESS_DENIED_ERROR
+alter event e1 on schedule every 1 day do select 1;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+# Not enough privileges to DROP EVENT
+begin work;
+insert into t1 (a) values ("OK: drop event: insufficient privileges");
+--error ER_DBACCESS_DENIED_ERROR
+drop event e1;
+rollback work;
+select * from t1;
+delete from t1;
+commit work;
+# Cleanup
+disconnect conn1;
+connection default;
+drop user mysqltest_user1@localhost;
+drop database mysqltest_db2;
+
+#
+# Cleanup
+#
+drop database events_test;
+
diff --git a/mysql-test/t/federated_server.test b/mysql-test/t/federated_server.test
index 3e47d9bc95d..87b67720104 100644
--- a/mysql-test/t/federated_server.test
+++ b/mysql-test/t/federated_server.test
@@ -2,7 +2,8 @@
# if federated can utilise the servers table
# should work with embedded server after mysqltest is fixed
-- source include/not_embedded.inc
-source include/federated.inc;
+-- source include/federated.inc;
+-- source include/big_test.inc
connection slave;
create database first_db;
@@ -17,6 +18,13 @@ CREATE TABLE first_db.t1 (
)
DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS first_db.t2;
+CREATE TABLE first_db.t2 (
+ `id` int(20) NOT NULL,
+ `name` varchar(64) NOT NULL default ''
+ )
+ DEFAULT CHARSET=latin1;
+
use second_db;
DROP TABLE IF EXISTS second_db.t1;
CREATE TABLE second_db.t1 (
@@ -25,6 +33,13 @@ CREATE TABLE second_db.t1 (
)
DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS second_db.t2;
+CREATE TABLE second_db.t2 (
+ `id` int(20) NOT NULL,
+ `name` varchar(64) NOT NULL default ''
+ )
+ DEFAULT CHARSET=latin1;
+
connection master;
drop server if exists 'server_one';
@@ -61,7 +76,7 @@ eval CREATE TABLE federated.old (
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/first_db/t1';
-INSERT INTO federated.old (id, name) values (1, 'federated.old url');
+INSERT INTO federated.old (id, name) values (1, 'federated.old-> first_db.t1, url format');
SELECT * FROM federated.old;
@@ -72,9 +87,32 @@ eval CREATE TABLE federated.old2 (
`name` varchar(64) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/first_db/t2';
+
+INSERT INTO federated.old2 (id, name) values (1, 'federated.old2-> first_db.t2, url format');
+SELECT * FROM federated.old2;
+
+DROP TABLE IF EXISTS federated.urldb2t1;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.urldb2t1 (
+ `id` int(20) NOT NULL,
+ `name` varchar(64) NOT NULL default ''
+ )
+ ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/second_db/t1';
+INSERT INTO federated.urldb2t1 (id, name) values (1, 'federated.urldb2t1 -> second_db.t1, url format');
+SELECT * FROM federated.urldb2t1;
-INSERT INTO federated.old2 (id, name) values (1, 'federated.old2 url');
+DROP TABLE IF EXISTS federated.urldb2t2;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.urldb2t2 (
+ `id` int(20) NOT NULL,
+ `name` varchar(64) NOT NULL default ''
+ )
+ ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/second_db/t2';
+INSERT INTO federated.urldb2t2 (id, name) values (1, 'federated.urldb2t2 -> second_db.t2, url format');
+SELECT * FROM federated.urldb2t2;
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
@@ -84,17 +122,30 @@ CREATE TABLE federated.t1 (
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='server_one';
-INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme');
+INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme, first_db.t1');
SELECT * FROM federated.t1;
+DROP TABLE IF EXISTS federated.whatever;
+CREATE TABLE federated.whatever (
+ `id` int(20) NOT NULL,
+ `name` varchar(64) NOT NULL default ''
+ )
+ ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+ CONNECTION='server_one/t1';
+INSERT INTO federated.whatever (id, name) values (1, 'server_one, new scheme, whatever, first_db.t1');
+SELECT * FROM federated.whatever;
+
ALTER SERVER 'server_one' options(DATABASE 'second_db');
-flush tables;
+# FLUSH TABLES is now unneccessary
-INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme');
+INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme, second_db.t1');
SELECT * FROM federated.t1;
+INSERT INTO federated.whatever (id, name) values (1, 'server_two, new scheme, whatever, second_db.t1');
+SELECT * FROM federated.whatever;
+
drop table federated.t1;
drop server 'server_one';
@@ -107,4 +158,168 @@ drop table second_db.t1;
drop database first_db;
drop database second_db;
+#
+# Bug#25671 - CREATE/DROP/ALTER SERVER should require privileges
+#
+# Changes to SERVER declarations should require SUPER privilege.
+# Based upon test case by Giuseppe Maxia
+
+create database db_legitimate;
+create database db_bogus;
+
+use db_legitimate;
+CREATE TABLE db_legitimate.t1 (
+ `id` int(20) NOT NULL,
+ `name` varchar(64) NOT NULL default ''
+ );
+INSERT INTO db_legitimate.t1 VALUES ('1','this is legitimate');
+
+use db_bogus;
+CREATE TABLE db_bogus.t1 (
+ `id` int(20) NOT NULL,
+ `name` varchar(64) NOT NULL default ''
+ )
+ ;
+INSERT INTO db_bogus.t1 VALUES ('2','this is bogus');
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval create server 's1' foreign data wrapper 'mysql' options
+ (HOST '127.0.0.1',
+ DATABASE 'db_legitimate',
+ USER 'root',
+ PASSWORD '',
+ PORT $SLAVE_MYPORT,
+ SOCKET '',
+ OWNER 'root');
+
+create user guest_select@localhost;
+grant select on federated.* to guest_select@localhost;
+
+create user guest_super@localhost;
+grant select,SUPER,RELOAD on *.* to guest_super@localhost;
+
+create user guest_usage@localhost;
+grant usage on *.* to guest_usage@localhost;
+
+CREATE TABLE federated.t1 (
+ `id` int(20) NOT NULL,
+ `name` varchar(64) NOT NULL default ''
+ ) ENGINE = FEDERATED CONNECTION = 's1';
+
+select * from federated.t1;
+
+connect (conn_select,127.0.0.1,guest_select,,federated,$MASTER_MYPORT);
+connect (conn_usage,127.0.0.1,guest_usage,,,$MASTER_MYPORT);
+connect (conn_super,127.0.0.1,guest_super,,,$MASTER_MYPORT);
+
+connection conn_select;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+alter server s1 options (database 'db_bogus');
+
+connection master;
+flush tables;
+select * from federated.t1;
+
+connection conn_usage;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+alter server s1 options (database 'db_bogus');
+
+connection master;
+flush tables;
+select * from federated.t1;
+
+connection conn_super;
+alter server s1 options (database 'db_bogus');
+
+connection master;
+flush tables;
+select * from federated.t1;
+
+connection conn_select;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+drop server if exists 's1';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+eval create server 's1' foreign data wrapper 'mysql' options
+ (HOST '127.0.0.1',
+ DATABASE 'db_legitimate',
+ USER 'root',
+ PASSWORD '',
+ PORT $SLAVE_MYPORT,
+ SOCKET '',
+ OWNER 'root');
+
+connection conn_super;
+drop server 's1';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval create server 's1' foreign data wrapper 'mysql' options
+ (HOST '127.0.0.1',
+ DATABASE 'db_legitimate',
+ USER 'root',
+ PASSWORD '',
+ PORT $SLAVE_MYPORT,
+ SOCKET '',
+ OWNER 'root');
+
+connection master;
+flush tables;
+select * from federated.t1;
+
+# clean up test
+connection slave;
+drop database db_legitimate;
+drop database db_bogus;
+
+disconnect conn_select;
+disconnect conn_usage;
+disconnect conn_super;
+
+connection master;
+drop user guest_super@localhost;
+drop user guest_usage@localhost;
+drop user guest_select@localhost;
+drop table federated.t1;
+drop server 's1';
+
+
+--echo # End of 5.1 tests
+
+
+#
+# Bug#25721 - deadlock with ALTER/CREATE SERVER
+#
+connect (other,localhost,root,,);
+connection master;
+use test;
+delimiter //;
+create procedure p1 ()
+begin
+ DECLARE v INT DEFAULT 0;
+ DECLARE e INT DEFAULT 0;
+ DECLARE i INT;
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET e = e + 1;
+ SET i = sleep(5);
+ WHILE v < 10000 do
+ CREATE SERVER s
+ FOREIGN DATA WRAPPER mysql
+ OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test');
+ ALTER SERVER s OPTIONS (USER 'Remote');
+ DROP SERVER s;
+ SET v = v + 1;
+ END WHILE;
+ SELECT e > 0;
+END//
+delimiter ;//
+connection other;
+use test;
+send call p1();
+connection master;
+call p1();
+connection other;
+reap;
+drop procedure p1;
+drop server if exists s;
+
+
source include/federated_cleanup.inc;
diff --git a/mysql-test/t/flush2.test b/mysql-test/t/flush2.test
index fc9e88e3141..7582ab8426b 100644
--- a/mysql-test/t/flush2.test
+++ b/mysql-test/t/flush2.test
@@ -3,7 +3,7 @@
#
flush logs;
set global expire_logs_days = 3;
-show variables like 'log%';
+show variables like 'log_bin%';
flush logs;
-show variables like 'log%';
+show variables like 'log_bin%';
set global expire_logs_days = 0;
diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test
index 5942ce119ee..8c13ae5cad9 100644
--- a/mysql-test/t/fulltext_left_join.test
+++ b/mysql-test/t/fulltext_left_join.test
@@ -87,3 +87,14 @@ SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance
DROP TABLE t1,t2;
# End of 4.1 tests
+
+#
+# BUG#25729 - boolean full text search is confused by NULLs produced by LEFT
+# JOIN
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, c TEXT, KEY(b));
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
+SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index c141fd370f8..431d582be50 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -497,4 +497,14 @@ select f2,group_concat(f1) from t1 group by f2;
--disable_metadata
drop table t1;
-# End of 4.1 tests
+#
+# Bug #26815: Unexpected built-in function behavior: group_concat(distinct
+# substring_index())
+#
+CREATE TABLE t1(a TEXT, b CHAR(20));
+INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3");
+SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 4989199f3aa..778bfc9528f 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -801,6 +801,16 @@ drop table bug22555;
#
+# Bug #21976: Unnecessary warning with count(decimal)
+#
+
+create table t1 (a decimal(20));
+insert into t1 values (12345678901234567890);
+select count(a) from t1;
+select count(distinct a) from t1;
+drop table t1;
+
+#
# Bug #23184: SELECT causes server crash
#
CREATE TABLE t1 (a INT, b INT);
@@ -824,5 +834,4 @@ SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50;
DROP TABLE t1;
-###
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 31352e4c639..e9583f982ff 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -361,6 +361,17 @@ SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29');
DROP TABLE t1,t2,t3,t4;
+#
+# BUG#27362: IN with a decimal expression that may return NULL
+#
+
+CREATE TABLE t1 (id int not null);
+INSERT INTO t1 VALUES (1),(2);
+
+SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) );
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test
index 77d7366afe6..bb65cbaa774 100644
--- a/mysql-test/t/func_sapdb.test
+++ b/mysql-test/t/func_sapdb.test
@@ -41,6 +41,8 @@ select datediff("1997-11-30 23:59:59.000001",null);
select weekofyear("1997-11-30 23:59:59.000001");
+select makedate(03,1);
+select makedate('0003',1);
select makedate(1997,1);
select makedate(1997,0);
select makedate(9999,365);
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 849d39cfc32..ca78ced134b 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1145,6 +1145,10 @@ INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2);
SELECT REPEAT( '#', tire ) AS A,
REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`;
+SELECT REPEAT('0', CAST(0 AS UNSIGNED));
+SELECT REPEAT('0', -2);
+SELECT REPEAT('0', 2);
+
DROP TABLE t1;
#
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index 1704fe7dc80..579ec65f149 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -172,7 +172,7 @@ CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
drop table t1, t2;
-CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
@@ -192,7 +192,7 @@ drop table t1;
#
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
- SPATIAL KEY i1 (c1(32))
+ SPATIAL KEY i1 (c1)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
@@ -206,7 +206,7 @@ DROP TABLE t1;
#
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
- SPATIAL KEY i1 (c1(32))
+ SPATIAL KEY i1 (c1)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
@@ -241,6 +241,562 @@ INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0)));
SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
DROP TABLE t1;
+
+#
+# Bug#25673 - spatial index corruption, error 126 incorrect key file for table
+#
+CREATE TABLE t1 (id bigint(12) unsigned NOT NULL auto_increment,
+ c2 varchar(15) collate utf8_bin default NULL,
+ c1 varchar(15) collate utf8_bin default NULL,
+ c3 varchar(10) collate utf8_bin default NULL,
+ spatial_point point NOT NULL,
+ PRIMARY KEY(id),
+ SPATIAL KEY (spatial_point)
+ )ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+#
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+ ('y', 's', 'j', GeomFromText('POINT(167 74)')),
+ ('r', 'n', 'd', GeomFromText('POINT(215 118)')),
+ ('g', 'n', 'e', GeomFromText('POINT(203 98)')),
+ ('h', 'd', 'd', GeomFromText('POINT(54 193)')),
+ ('r', 'x', 'y', GeomFromText('POINT(47 69)')),
+ ('t', 'q', 'r', GeomFromText('POINT(109 42)')),
+ ('a', 'z', 'd', GeomFromText('POINT(0 154)')),
+ ('x', 'v', 'o', GeomFromText('POINT(174 131)')),
+ ('b', 'r', 'a', GeomFromText('POINT(114 253)')),
+ ('x', 'z', 'i', GeomFromText('POINT(163 21)')),
+ ('w', 'p', 'i', GeomFromText('POINT(42 102)')),
+ ('g', 'j', 'j', GeomFromText('POINT(170 133)')),
+ ('m', 'g', 'n', GeomFromText('POINT(28 22)')),
+ ('b', 'z', 'h', GeomFromText('POINT(174 28)')),
+ ('q', 'k', 'f', GeomFromText('POINT(233 73)')),
+ ('w', 'w', 'a', GeomFromText('POINT(124 200)')),
+ ('t', 'j', 'w', GeomFromText('POINT(252 101)')),
+ ('d', 'r', 'd', GeomFromText('POINT(98 18)')),
+ ('w', 'o', 'y', GeomFromText('POINT(165 31)')),
+ ('y', 'h', 't', GeomFromText('POINT(14 220)')),
+ ('d', 'p', 'u', GeomFromText('POINT(223 196)')),
+ ('g', 'y', 'g', GeomFromText('POINT(207 96)')),
+ ('x', 'm', 'n', GeomFromText('POINT(214 3)')),
+ ('g', 'v', 'e', GeomFromText('POINT(140 205)')),
+ ('g', 'm', 'm', GeomFromText('POINT(10 236)')),
+ ('i', 'r', 'j', GeomFromText('POINT(137 228)')),
+ ('w', 's', 'p', GeomFromText('POINT(115 6)')),
+ ('o', 'n', 'k', GeomFromText('POINT(158 129)')),
+ ('j', 'h', 'l', GeomFromText('POINT(129 72)')),
+ ('f', 'x', 'l', GeomFromText('POINT(139 207)')),
+ ('u', 'd', 'n', GeomFromText('POINT(125 109)')),
+ ('b', 'a', 'z', GeomFromText('POINT(30 32)')),
+ ('m', 'h', 'o', GeomFromText('POINT(251 251)')),
+ ('f', 'r', 'd', GeomFromText('POINT(243 211)')),
+ ('b', 'd', 'r', GeomFromText('POINT(232 80)')),
+ ('g', 'k', 'v', GeomFromText('POINT(15 100)')),
+ ('i', 'f', 'c', GeomFromText('POINT(109 66)')),
+ ('r', 't', 'j', GeomFromText('POINT(178 6)')),
+ ('y', 'n', 'f', GeomFromText('POINT(233 211)')),
+ ('f', 'y', 'm', GeomFromText('POINT(99 16)')),
+ ('z', 'q', 'l', GeomFromText('POINT(39 49)')),
+ ('j', 'c', 'r', GeomFromText('POINT(75 187)')),
+ ('c', 'y', 'y', GeomFromText('POINT(246 253)')),
+ ('w', 'u', 'd', GeomFromText('POINT(56 190)')),
+ ('n', 'q', 'm', GeomFromText('POINT(73 149)')),
+ ('d', 'y', 'a', GeomFromText('POINT(134 6)')),
+ ('z', 's', 'w', GeomFromText('POINT(216 225)')),
+ ('d', 'u', 'k', GeomFromText('POINT(132 70)')),
+ ('f', 'v', 't', GeomFromText('POINT(187 141)')),
+ ('r', 'r', 'a', GeomFromText('POINT(152 39)')),
+ ('y', 'p', 'o', GeomFromText('POINT(45 27)')),
+ ('p', 'n', 'm', GeomFromText('POINT(228 148)')),
+ ('e', 'g', 'e', GeomFromText('POINT(88 81)')),
+ ('m', 'a', 'h', GeomFromText('POINT(35 29)')),
+ ('m', 'h', 'f', GeomFromText('POINT(30 71)')),
+ ('h', 'k', 'i', GeomFromText('POINT(244 78)')),
+ ('z', 'v', 'd', GeomFromText('POINT(241 38)')),
+ ('q', 'l', 'j', GeomFromText('POINT(13 71)')),
+ ('s', 'p', 'g', GeomFromText('POINT(108 38)')),
+ ('q', 's', 'j', GeomFromText('POINT(92 101)')),
+ ('l', 'h', 'g', GeomFromText('POINT(120 78)')),
+ ('w', 't', 'b', GeomFromText('POINT(193 109)')),
+ ('b', 's', 's', GeomFromText('POINT(223 211)')),
+ ('w', 'w', 'y', GeomFromText('POINT(122 42)')),
+ ('q', 'c', 'c', GeomFromText('POINT(104 102)')),
+ ('w', 'g', 'n', GeomFromText('POINT(213 120)')),
+ ('p', 'q', 'a', GeomFromText('POINT(247 148)')),
+ ('c', 'z', 'e', GeomFromText('POINT(18 106)')),
+ ('z', 'u', 'n', GeomFromText('POINT(70 133)')),
+ ('j', 'n', 'x', GeomFromText('POINT(232 13)')),
+ ('e', 'h', 'f', GeomFromText('POINT(22 135)')),
+ ('w', 'l', 'f', GeomFromText('POINT(9 180)')),
+ ('a', 'v', 'q', GeomFromText('POINT(163 228)')),
+ ('i', 'z', 'o', GeomFromText('POINT(180 100)')),
+ ('e', 'c', 'l', GeomFromText('POINT(182 231)')),
+ ('c', 'k', 'o', GeomFromText('POINT(19 60)')),
+ ('q', 'f', 'p', GeomFromText('POINT(79 95)')),
+ ('m', 'd', 'r', GeomFromText('POINT(3 127)')),
+ ('m', 'e', 't', GeomFromText('POINT(136 154)')),
+ ('w', 'w', 'w', GeomFromText('POINT(102 15)')),
+ ('l', 'n', 'q', GeomFromText('POINT(71 196)')),
+ ('p', 'k', 'c', GeomFromText('POINT(47 139)')),
+ ('j', 'o', 'r', GeomFromText('POINT(177 128)')),
+ ('j', 'q', 'a', GeomFromText('POINT(170 6)')),
+ ('b', 'a', 'o', GeomFromText('POINT(63 211)')),
+ ('g', 's', 'o', GeomFromText('POINT(144 251)')),
+ ('w', 'u', 'w', GeomFromText('POINT(221 214)')),
+ ('g', 'a', 'm', GeomFromText('POINT(14 102)')),
+ ('u', 'q', 'z', GeomFromText('POINT(86 200)')),
+ ('k', 'a', 'm', GeomFromText('POINT(144 222)')),
+ ('j', 'u', 'r', GeomFromText('POINT(216 142)')),
+ ('q', 'k', 'v', GeomFromText('POINT(121 236)')),
+ ('p', 'o', 'r', GeomFromText('POINT(108 102)')),
+ ('b', 'd', 'x', GeomFromText('POINT(127 198)')),
+ ('k', 's', 'a', GeomFromText('POINT(2 150)')),
+ ('f', 'm', 'f', GeomFromText('POINT(160 191)')),
+ ('q', 'y', 'x', GeomFromText('POINT(98 111)')),
+ ('o', 'f', 'm', GeomFromText('POINT(232 218)')),
+ ('c', 'w', 'j', GeomFromText('POINT(156 165)')),
+ ('s', 'q', 'v', GeomFromText('POINT(98 161)'));
+SET @@RAND_SEED1=692635050, @@RAND_SEED2=297339954;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=159925977, @@RAND_SEED2=942570618;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=328169745, @@RAND_SEED2=410451954;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=178507359, @@RAND_SEED2=332493072;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=1034033013, @@RAND_SEED2=558966507;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+UPDATE t1 set spatial_point=GeomFromText('POINT(230 9)') where c1 like 'y%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(95 35)') where c1 like 'j%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(93 99)') where c1 like 'a%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(19 81)') where c1 like 'r%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(20 177)') where c1 like 'h%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(221 193)') where c1 like 'u%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(195 205)') where c1 like 'd%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(15 213)') where c1 like 'u%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(214 63)') where c1 like 'n%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(243 171)') where c1 like 'c%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(198 82)') where c1 like 'y%';
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+ ('f', 'y', 'p', GeomFromText('POINT(109 235)')),
+ ('b', 'e', 'v', GeomFromText('POINT(20 48)')),
+ ('i', 'u', 'f', GeomFromText('POINT(15 55)')),
+ ('o', 'r', 'z', GeomFromText('POINT(105 64)')),
+ ('a', 'p', 'a', GeomFromText('POINT(142 236)')),
+ ('g', 'i', 'k', GeomFromText('POINT(10 49)')),
+ ('x', 'z', 'x', GeomFromText('POINT(192 200)')),
+ ('c', 'v', 'r', GeomFromText('POINT(94 168)')),
+ ('y', 'z', 'e', GeomFromText('POINT(141 51)')),
+ ('h', 'm', 'd', GeomFromText('POINT(35 251)')),
+ ('v', 'm', 'q', GeomFromText('POINT(44 90)')),
+ ('j', 'l', 'z', GeomFromText('POINT(67 237)')),
+ ('i', 'v', 'a', GeomFromText('POINT(75 14)')),
+ ('b', 'q', 't', GeomFromText('POINT(153 33)')),
+ ('e', 'm', 'a', GeomFromText('POINT(247 49)')),
+ ('l', 'y', 'g', GeomFromText('POINT(56 203)')),
+ ('v', 'o', 'r', GeomFromText('POINT(90 54)')),
+ ('r', 'n', 'd', GeomFromText('POINT(135 83)')),
+ ('j', 't', 'u', GeomFromText('POINT(174 239)')),
+ ('u', 'n', 'g', GeomFromText('POINT(104 191)')),
+ ('p', 'q', 'y', GeomFromText('POINT(63 171)')),
+ ('o', 'q', 'p', GeomFromText('POINT(192 103)')),
+ ('f', 'x', 'e', GeomFromText('POINT(244 30)')),
+ ('n', 'x', 'c', GeomFromText('POINT(92 103)')),
+ ('r', 'q', 'z', GeomFromText('POINT(166 20)')),
+ ('s', 'a', 'j', GeomFromText('POINT(137 205)')),
+ ('z', 't', 't', GeomFromText('POINT(99 134)')),
+ ('o', 'm', 'j', GeomFromText('POINT(217 3)')),
+ ('n', 'h', 'j', GeomFromText('POINT(211 17)')),
+ ('v', 'v', 'a', GeomFromText('POINT(41 137)')),
+ ('q', 'o', 'j', GeomFromText('POINT(5 92)')),
+ ('z', 'y', 'e', GeomFromText('POINT(175 212)')),
+ ('j', 'z', 'h', GeomFromText('POINT(224 194)')),
+ ('a', 'g', 'm', GeomFromText('POINT(31 119)')),
+ ('p', 'c', 'f', GeomFromText('POINT(17 221)')),
+ ('t', 'h', 'k', GeomFromText('POINT(26 203)')),
+ ('u', 'w', 'p', GeomFromText('POINT(47 185)')),
+ ('z', 'a', 'c', GeomFromText('POINT(61 133)')),
+ ('u', 'k', 'a', GeomFromText('POINT(210 115)')),
+ ('k', 'f', 'h', GeomFromText('POINT(125 113)')),
+ ('t', 'v', 'y', GeomFromText('POINT(12 239)')),
+ ('u', 'v', 'd', GeomFromText('POINT(90 24)')),
+ ('m', 'y', 'w', GeomFromText('POINT(25 243)')),
+ ('d', 'n', 'g', GeomFromText('POINT(122 92)')),
+ ('z', 'm', 'f', GeomFromText('POINT(235 110)')),
+ ('q', 'd', 'f', GeomFromText('POINT(233 217)')),
+ ('a', 'v', 'u', GeomFromText('POINT(69 59)')),
+ ('x', 'k', 'p', GeomFromText('POINT(240 14)')),
+ ('i', 'v', 'r', GeomFromText('POINT(154 42)')),
+ ('w', 'h', 'l', GeomFromText('POINT(178 156)')),
+ ('d', 'h', 'n', GeomFromText('POINT(65 157)')),
+ ('c', 'k', 'z', GeomFromText('POINT(62 33)')),
+ ('e', 'l', 'w', GeomFromText('POINT(162 1)')),
+ ('r', 'f', 'i', GeomFromText('POINT(127 71)')),
+ ('q', 'm', 'c', GeomFromText('POINT(63 118)')),
+ ('c', 'h', 'u', GeomFromText('POINT(205 203)')),
+ ('d', 't', 'p', GeomFromText('POINT(234 87)')),
+ ('s', 'g', 'h', GeomFromText('POINT(149 34)')),
+ ('o', 'b', 'q', GeomFromText('POINT(159 179)')),
+ ('k', 'u', 'f', GeomFromText('POINT(202 254)')),
+ ('u', 'f', 'g', GeomFromText('POINT(70 15)')),
+ ('x', 's', 'b', GeomFromText('POINT(25 181)')),
+ ('s', 'c', 'g', GeomFromText('POINT(252 17)')),
+ ('a', 'c', 'f', GeomFromText('POINT(89 67)')),
+ ('r', 'e', 'q', GeomFromText('POINT(55 54)')),
+ ('f', 'i', 'k', GeomFromText('POINT(178 230)')),
+ ('p', 'e', 'l', GeomFromText('POINT(198 28)')),
+ ('w', 'o', 'd', GeomFromText('POINT(204 189)')),
+ ('c', 'a', 'g', GeomFromText('POINT(230 178)')),
+ ('r', 'o', 'e', GeomFromText('POINT(61 116)')),
+ ('w', 'a', 'a', GeomFromText('POINT(178 237)')),
+ ('v', 'd', 'e', GeomFromText('POINT(70 85)')),
+ ('k', 'c', 'e', GeomFromText('POINT(147 118)')),
+ ('d', 'q', 't', GeomFromText('POINT(218 77)')),
+ ('k', 'g', 'f', GeomFromText('POINT(192 113)')),
+ ('w', 'n', 'e', GeomFromText('POINT(92 124)')),
+ ('r', 'm', 'q', GeomFromText('POINT(130 65)')),
+ ('o', 'r', 'r', GeomFromText('POINT(174 233)')),
+ ('k', 'n', 't', GeomFromText('POINT(175 147)')),
+ ('q', 'm', 'r', GeomFromText('POINT(18 208)')),
+ ('l', 'd', 'i', GeomFromText('POINT(13 104)')),
+ ('w', 'o', 'y', GeomFromText('POINT(207 39)')),
+ ('p', 'u', 'o', GeomFromText('POINT(114 31)')),
+ ('y', 'a', 'p', GeomFromText('POINT(106 59)')),
+ ('a', 'x', 'z', GeomFromText('POINT(17 57)')),
+ ('v', 'h', 'x', GeomFromText('POINT(170 13)')),
+ ('t', 's', 'u', GeomFromText('POINT(84 18)')),
+ ('z', 'z', 'f', GeomFromText('POINT(250 197)')),
+ ('l', 'z', 't', GeomFromText('POINT(59 80)')),
+ ('j', 'g', 's', GeomFromText('POINT(54 26)')),
+ ('g', 'v', 'm', GeomFromText('POINT(89 98)')),
+ ('q', 'v', 'b', GeomFromText('POINT(39 240)')),
+ ('x', 'k', 'v', GeomFromText('POINT(246 207)')),
+ ('k', 'u', 'i', GeomFromText('POINT(105 111)')),
+ ('w', 'z', 's', GeomFromText('POINT(235 8)')),
+ ('d', 'd', 'd', GeomFromText('POINT(105 4)')),
+ ('c', 'z', 'q', GeomFromText('POINT(13 140)')),
+ ('m', 'k', 'i', GeomFromText('POINT(208 120)')),
+ ('g', 'a', 'g', GeomFromText('POINT(9 182)')),
+ ('z', 'j', 'r', GeomFromText('POINT(149 153)')),
+ ('h', 'f', 'g', GeomFromText('POINT(81 236)')),
+ ('m', 'e', 'q', GeomFromText('POINT(209 215)')),
+ ('c', 'h', 'y', GeomFromText('POINT(235 70)')),
+ ('i', 'e', 'g', GeomFromText('POINT(138 26)')),
+ ('m', 't', 'u', GeomFromText('POINT(119 237)')),
+ ('o', 'w', 's', GeomFromText('POINT(193 166)')),
+ ('f', 'm', 'q', GeomFromText('POINT(85 96)')),
+ ('x', 'l', 'x', GeomFromText('POINT(58 115)')),
+ ('x', 'q', 'u', GeomFromText('POINT(108 210)')),
+ ('b', 'h', 'i', GeomFromText('POINT(250 139)')),
+ ('y', 'd', 'x', GeomFromText('POINT(199 135)')),
+ ('w', 'h', 'p', GeomFromText('POINT(247 233)')),
+ ('p', 'z', 't', GeomFromText('POINT(148 249)')),
+ ('q', 'a', 'u', GeomFromText('POINT(174 78)')),
+ ('v', 't', 'm', GeomFromText('POINT(70 228)')),
+ ('t', 'n', 'f', GeomFromText('POINT(123 2)')),
+ ('x', 't', 'b', GeomFromText('POINT(35 50)')),
+ ('r', 'j', 'f', GeomFromText('POINT(200 51)')),
+ ('s', 'q', 'o', GeomFromText('POINT(23 184)')),
+ ('u', 'v', 'z', GeomFromText('POINT(7 113)')),
+ ('v', 'u', 'l', GeomFromText('POINT(145 190)')),
+ ('o', 'k', 'i', GeomFromText('POINT(161 122)')),
+ ('l', 'y', 'e', GeomFromText('POINT(17 232)')),
+ ('t', 'b', 'e', GeomFromText('POINT(120 50)')),
+ ('e', 's', 'u', GeomFromText('POINT(254 1)')),
+ ('d', 'd', 'u', GeomFromText('POINT(167 140)')),
+ ('o', 'b', 'x', GeomFromText('POINT(186 237)')),
+ ('m', 's', 's', GeomFromText('POINT(172 149)')),
+ ('t', 'y', 'a', GeomFromText('POINT(149 85)')),
+ ('x', 't', 'r', GeomFromText('POINT(10 165)')),
+ ('g', 'c', 'e', GeomFromText('POINT(95 165)')),
+ ('e', 'e', 'z', GeomFromText('POINT(98 65)')),
+ ('f', 'v', 'i', GeomFromText('POINT(149 144)')),
+ ('o', 'p', 'm', GeomFromText('POINT(233 67)')),
+ ('t', 'u', 'b', GeomFromText('POINT(109 215)')),
+ ('o', 'o', 'b', GeomFromText('POINT(130 48)')),
+ ('e', 'm', 'h', GeomFromText('POINT(88 189)')),
+ ('e', 'v', 'y', GeomFromText('POINT(55 29)')),
+ ('e', 't', 'm', GeomFromText('POINT(129 55)')),
+ ('p', 'p', 'i', GeomFromText('POINT(126 222)')),
+ ('c', 'i', 'c', GeomFromText('POINT(19 158)')),
+ ('c', 'b', 's', GeomFromText('POINT(13 19)')),
+ ('u', 'y', 'a', GeomFromText('POINT(114 5)')),
+ ('a', 'o', 'f', GeomFromText('POINT(227 232)')),
+ ('t', 'c', 'z', GeomFromText('POINT(63 62)')),
+ ('d', 'o', 'k', GeomFromText('POINT(48 228)')),
+ ('x', 'c', 'e', GeomFromText('POINT(204 2)')),
+ ('e', 'e', 'g', GeomFromText('POINT(125 43)')),
+ ('o', 'r', 'f', GeomFromText('POINT(171 140)'));
+UPDATE t1 set spatial_point=GeomFromText('POINT(163 157)') where c1 like 'w%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(53 151)') where c1 like 'd%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(96 183)') where c1 like 'r%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(57 91)') where c1 like 'q%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(202 110)') where c1 like 'c%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(120 137)') where c1 like 'w%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(207 147)') where c1 like 'c%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(31 125)') where c1 like 'e%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(27 36)') where c1 like 'r%';
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+ ('b', 'c', 'e', GeomFromText('POINT(41 137)')),
+ ('p', 'y', 'k', GeomFromText('POINT(50 22)')),
+ ('s', 'c', 'h', GeomFromText('POINT(208 173)')),
+ ('x', 'u', 'l', GeomFromText('POINT(199 175)')),
+ ('s', 'r', 'h', GeomFromText('POINT(85 192)')),
+ ('j', 'k', 'u', GeomFromText('POINT(18 25)')),
+ ('p', 'w', 'h', GeomFromText('POINT(152 197)')),
+ ('e', 'd', 'c', GeomFromText('POINT(229 3)')),
+ ('o', 'x', 'k', GeomFromText('POINT(187 155)')),
+ ('o', 'b', 'k', GeomFromText('POINT(208 150)')),
+ ('d', 'a', 'j', GeomFromText('POINT(70 87)')),
+ ('f', 'e', 'k', GeomFromText('POINT(156 96)')),
+ ('u', 'y', 'p', GeomFromText('POINT(239 193)')),
+ ('n', 'v', 'p', GeomFromText('POINT(223 98)')),
+ ('z', 'j', 'r', GeomFromText('POINT(87 89)')),
+ ('h', 'x', 'x', GeomFromText('POINT(92 0)')),
+ ('r', 'v', 'r', GeomFromText('POINT(159 139)')),
+ ('v', 'g', 'g', GeomFromText('POINT(16 229)')),
+ ('z', 'k', 'u', GeomFromText('POINT(99 52)')),
+ ('p', 'p', 'o', GeomFromText('POINT(105 125)')),
+ ('w', 'h', 'y', GeomFromText('POINT(105 154)')),
+ ('v', 'y', 'z', GeomFromText('POINT(134 238)')),
+ ('x', 'o', 'o', GeomFromText('POINT(178 88)')),
+ ('z', 'w', 'd', GeomFromText('POINT(123 60)')),
+ ('q', 'f', 'u', GeomFromText('POINT(64 90)')),
+ ('s', 'n', 't', GeomFromText('POINT(50 138)')),
+ ('v', 'p', 't', GeomFromText('POINT(114 91)')),
+ ('a', 'o', 'n', GeomFromText('POINT(78 43)')),
+ ('k', 'u', 'd', GeomFromText('POINT(185 161)')),
+ ('w', 'd', 'n', GeomFromText('POINT(25 92)')),
+ ('k', 'w', 'a', GeomFromText('POINT(59 238)')),
+ ('t', 'c', 'f', GeomFromText('POINT(65 87)')),
+ ('g', 's', 'p', GeomFromText('POINT(238 126)')),
+ ('d', 'n', 'y', GeomFromText('POINT(107 173)')),
+ ('l', 'a', 'w', GeomFromText('POINT(125 152)')),
+ ('m', 'd', 'j', GeomFromText('POINT(146 53)')),
+ ('q', 'm', 'c', GeomFromText('POINT(217 187)')),
+ ('i', 'r', 'r', GeomFromText('POINT(6 113)')),
+ ('e', 'j', 'b', GeomFromText('POINT(37 83)')),
+ ('w', 'w', 'h', GeomFromText('POINT(83 199)')),
+ ('k', 'b', 's', GeomFromText('POINT(170 64)')),
+ ('s', 'b', 'c', GeomFromText('POINT(163 130)')),
+ ('c', 'h', 'a', GeomFromText('POINT(141 3)')),
+ ('k', 'j', 'u', GeomFromText('POINT(143 76)')),
+ ('r', 'h', 'o', GeomFromText('POINT(243 92)')),
+ ('i', 'd', 'b', GeomFromText('POINT(205 13)')),
+ ('r', 'y', 'q', GeomFromText('POINT(138 8)')),
+ ('m', 'o', 'i', GeomFromText('POINT(36 45)')),
+ ('v', 'g', 'm', GeomFromText('POINT(0 40)')),
+ ('f', 'e', 'i', GeomFromText('POINT(76 6)')),
+ ('c', 'q', 'q', GeomFromText('POINT(115 248)')),
+ ('x', 'c', 'i', GeomFromText('POINT(29 74)')),
+ ('l', 's', 't', GeomFromText('POINT(83 18)')),
+ ('t', 't', 'a', GeomFromText('POINT(26 168)')),
+ ('u', 'n', 'x', GeomFromText('POINT(200 110)')),
+ ('j', 'b', 'd', GeomFromText('POINT(216 136)')),
+ ('s', 'p', 'w', GeomFromText('POINT(38 156)')),
+ ('f', 'b', 'v', GeomFromText('POINT(29 186)')),
+ ('v', 'e', 'r', GeomFromText('POINT(149 40)')),
+ ('v', 't', 'm', GeomFromText('POINT(184 24)')),
+ ('y', 'g', 'a', GeomFromText('POINT(219 105)')),
+ ('s', 'f', 'i', GeomFromText('POINT(114 130)')),
+ ('e', 'q', 'h', GeomFromText('POINT(203 135)')),
+ ('h', 'g', 'b', GeomFromText('POINT(9 208)')),
+ ('o', 'l', 'r', GeomFromText('POINT(245 79)')),
+ ('s', 's', 'v', GeomFromText('POINT(238 198)')),
+ ('w', 'w', 'z', GeomFromText('POINT(209 232)')),
+ ('v', 'd', 'n', GeomFromText('POINT(30 193)')),
+ ('q', 'w', 'k', GeomFromText('POINT(133 18)')),
+ ('o', 'h', 'o', GeomFromText('POINT(42 140)')),
+ ('f', 'f', 'h', GeomFromText('POINT(145 1)')),
+ ('u', 's', 'r', GeomFromText('POINT(70 62)')),
+ ('x', 'n', 'q', GeomFromText('POINT(33 86)')),
+ ('u', 'p', 'v', GeomFromText('POINT(232 220)')),
+ ('z', 'e', 'a', GeomFromText('POINT(130 69)')),
+ ('r', 'u', 'z', GeomFromText('POINT(243 241)')),
+ ('b', 'n', 't', GeomFromText('POINT(120 12)')),
+ ('u', 'f', 's', GeomFromText('POINT(190 212)')),
+ ('a', 'd', 'q', GeomFromText('POINT(235 191)')),
+ ('f', 'q', 'm', GeomFromText('POINT(176 2)')),
+ ('n', 'c', 's', GeomFromText('POINT(218 163)')),
+ ('e', 'm', 'h', GeomFromText('POINT(163 108)')),
+ ('c', 'f', 'l', GeomFromText('POINT(220 115)')),
+ ('c', 'v', 'q', GeomFromText('POINT(66 45)')),
+ ('w', 'v', 'x', GeomFromText('POINT(251 220)')),
+ ('f', 'w', 'z', GeomFromText('POINT(146 149)')),
+ ('h', 'n', 'h', GeomFromText('POINT(148 128)')),
+ ('y', 'k', 'v', GeomFromText('POINT(28 110)')),
+ ('c', 'x', 'q', GeomFromText('POINT(13 13)')),
+ ('e', 'd', 's', GeomFromText('POINT(91 190)')),
+ ('c', 'w', 'c', GeomFromText('POINT(10 231)')),
+ ('u', 'j', 'n', GeomFromText('POINT(250 21)')),
+ ('w', 'n', 'x', GeomFromText('POINT(141 69)')),
+ ('f', 'p', 'y', GeomFromText('POINT(228 246)')),
+ ('d', 'q', 'f', GeomFromText('POINT(194 22)')),
+ ('d', 'z', 'l', GeomFromText('POINT(233 181)')),
+ ('c', 'a', 'q', GeomFromText('POINT(183 96)')),
+ ('m', 'i', 'd', GeomFromText('POINT(117 226)')),
+ ('z', 'y', 'y', GeomFromText('POINT(62 81)')),
+ ('g', 'v', 'm', GeomFromText('POINT(66 158)'));
+SET @@RAND_SEED1=481064922, @@RAND_SEED2=438133497;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=280535103, @@RAND_SEED2=444518646;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=1072017234, @@RAND_SEED2=484203885;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=358851897, @@RAND_SEED2=358495224;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+SET @@RAND_SEED1=509031459, @@RAND_SEED2=675962925;
+DELETE FROM t1 ORDER BY RAND() LIMIT 10;
+UPDATE t1 set spatial_point=GeomFromText('POINT(61 203)') where c1 like 'y%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(202 194)') where c1 like 'f%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(228 18)') where c1 like 'h%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(88 18)') where c1 like 'l%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(176 94)') where c1 like 'e%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(44 47)') where c1 like 'g%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(95 191)') where c1 like 'b%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(179 218)') where c1 like 'y%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(239 40)') where c1 like 'g%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(248 41)') where c1 like 'q%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(167 82)') where c1 like 't%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(13 104)') where c1 like 'u%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(139 84)') where c1 like 'a%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(145 108)') where c1 like 'p%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(147 57)') where c1 like 't%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(217 144)') where c1 like 'n%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(160 224)') where c1 like 'w%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(38 28)') where c1 like 'j%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(104 114)') where c1 like 'q%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(88 19)') where c1 like 'c%';
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+ ('f', 'x', 'p', GeomFromText('POINT(92 181)')),
+ ('s', 'i', 'c', GeomFromText('POINT(49 60)')),
+ ('c', 'c', 'i', GeomFromText('POINT(7 57)')),
+ ('n', 'g', 'k', GeomFromText('POINT(252 105)')),
+ ('g', 'b', 'm', GeomFromText('POINT(180 11)')),
+ ('u', 'l', 'r', GeomFromText('POINT(32 90)')),
+ ('c', 'x', 'e', GeomFromText('POINT(143 24)')),
+ ('x', 'u', 'a', GeomFromText('POINT(123 92)')),
+ ('s', 'b', 'h', GeomFromText('POINT(190 108)')),
+ ('c', 'x', 'b', GeomFromText('POINT(104 100)')),
+ ('i', 'd', 't', GeomFromText('POINT(214 104)')),
+ ('r', 'w', 'g', GeomFromText('POINT(29 67)')),
+ ('b', 'f', 'g', GeomFromText('POINT(149 46)')),
+ ('r', 'r', 'd', GeomFromText('POINT(242 196)')),
+ ('j', 'l', 'a', GeomFromText('POINT(90 196)')),
+ ('e', 't', 'b', GeomFromText('POINT(190 64)')),
+ ('l', 'x', 'w', GeomFromText('POINT(250 73)')),
+ ('q', 'y', 'r', GeomFromText('POINT(120 182)')),
+ ('s', 'j', 'a', GeomFromText('POINT(180 175)')),
+ ('n', 'i', 'y', GeomFromText('POINT(124 136)')),
+ ('s', 'x', 's', GeomFromText('POINT(176 209)')),
+ ('u', 'f', 's', GeomFromText('POINT(215 173)')),
+ ('m', 'j', 'x', GeomFromText('POINT(44 140)')),
+ ('v', 'g', 'x', GeomFromText('POINT(177 233)')),
+ ('u', 't', 'b', GeomFromText('POINT(136 197)')),
+ ('f', 'g', 'b', GeomFromText('POINT(10 8)')),
+ ('v', 'c', 'j', GeomFromText('POINT(13 81)')),
+ ('d', 's', 'q', GeomFromText('POINT(200 100)')),
+ ('a', 'p', 'j', GeomFromText('POINT(33 40)')),
+ ('i', 'c', 'g', GeomFromText('POINT(168 204)')),
+ ('k', 'h', 'i', GeomFromText('POINT(93 243)')),
+ ('s', 'b', 's', GeomFromText('POINT(157 13)')),
+ ('v', 'l', 'l', GeomFromText('POINT(103 6)')),
+ ('r', 'b', 'k', GeomFromText('POINT(244 137)')),
+ ('l', 'd', 'r', GeomFromText('POINT(162 254)')),
+ ('q', 'b', 'z', GeomFromText('POINT(136 246)')),
+ ('x', 'x', 'p', GeomFromText('POINT(120 37)')),
+ ('m', 'e', 'z', GeomFromText('POINT(203 167)')),
+ ('q', 'n', 'p', GeomFromText('POINT(94 119)')),
+ ('b', 'g', 'u', GeomFromText('POINT(93 248)')),
+ ('r', 'v', 'v', GeomFromText('POINT(53 88)')),
+ ('y', 'a', 'i', GeomFromText('POINT(98 219)')),
+ ('a', 's', 'g', GeomFromText('POINT(173 138)')),
+ ('c', 'a', 't', GeomFromText('POINT(235 135)')),
+ ('q', 'm', 'd', GeomFromText('POINT(224 208)')),
+ ('e', 'p', 'k', GeomFromText('POINT(161 238)')),
+ ('n', 'g', 'q', GeomFromText('POINT(35 204)')),
+ ('t', 't', 'x', GeomFromText('POINT(230 178)')),
+ ('w', 'f', 'a', GeomFromText('POINT(150 221)')),
+ ('z', 'm', 'z', GeomFromText('POINT(119 42)')),
+ ('l', 'j', 's', GeomFromText('POINT(97 96)')),
+ ('f', 'z', 'x', GeomFromText('POINT(208 65)')),
+ ('i', 'v', 'c', GeomFromText('POINT(145 79)')),
+ ('l', 'f', 'k', GeomFromText('POINT(83 234)')),
+ ('u', 'a', 's', GeomFromText('POINT(250 49)')),
+ ('o', 'k', 'p', GeomFromText('POINT(46 50)')),
+ ('d', 'e', 'z', GeomFromText('POINT(30 198)')),
+ ('r', 'r', 'l', GeomFromText('POINT(78 189)')),
+ ('y', 'l', 'f', GeomFromText('POINT(188 132)')),
+ ('d', 'q', 'm', GeomFromText('POINT(247 107)')),
+ ('p', 'j', 'n', GeomFromText('POINT(148 227)')),
+ ('b', 'o', 'i', GeomFromText('POINT(172 25)')),
+ ('e', 'v', 'd', GeomFromText('POINT(94 248)')),
+ ('q', 'd', 'f', GeomFromText('POINT(15 29)')),
+ ('w', 'b', 'b', GeomFromText('POINT(74 111)')),
+ ('g', 'q', 'f', GeomFromText('POINT(107 215)')),
+ ('o', 'h', 'r', GeomFromText('POINT(25 168)')),
+ ('u', 't', 'w', GeomFromText('POINT(251 188)')),
+ ('h', 's', 'w', GeomFromText('POINT(254 247)')),
+ ('f', 'f', 'b', GeomFromText('POINT(166 103)'));
+SET @@RAND_SEED1=866613816, @@RAND_SEED2=92289615;
+INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
+ ('l', 'c', 'l', GeomFromText('POINT(202 98)')),
+ ('k', 'c', 'b', GeomFromText('POINT(46 206)')),
+ ('r', 'y', 'm', GeomFromText('POINT(74 140)')),
+ ('y', 'z', 'd', GeomFromText('POINT(200 160)')),
+ ('s', 'y', 's', GeomFromText('POINT(156 205)')),
+ ('u', 'v', 'p', GeomFromText('POINT(86 82)')),
+ ('j', 's', 's', GeomFromText('POINT(91 233)')),
+ ('x', 'j', 'f', GeomFromText('POINT(3 14)')),
+ ('l', 'z', 'v', GeomFromText('POINT(123 156)')),
+ ('h', 'i', 'o', GeomFromText('POINT(145 229)')),
+ ('o', 'r', 'd', GeomFromText('POINT(15 22)')),
+ ('f', 'x', 't', GeomFromText('POINT(21 60)')),
+ ('t', 'g', 'h', GeomFromText('POINT(50 153)')),
+ ('g', 'u', 'b', GeomFromText('POINT(82 85)')),
+ ('v', 'a', 'p', GeomFromText('POINT(231 178)')),
+ ('n', 'v', 'o', GeomFromText('POINT(183 25)')),
+ ('j', 'n', 'm', GeomFromText('POINT(50 144)')),
+ ('e', 'f', 'i', GeomFromText('POINT(46 16)')),
+ ('d', 'w', 'a', GeomFromText('POINT(66 6)')),
+ ('f', 'x', 'a', GeomFromText('POINT(107 197)')),
+ ('m', 'o', 'a', GeomFromText('POINT(142 80)')),
+ ('q', 'l', 'g', GeomFromText('POINT(251 23)')),
+ ('c', 's', 's', GeomFromText('POINT(158 43)')),
+ ('y', 'd', 'o', GeomFromText('POINT(196 228)')),
+ ('d', 'p', 'l', GeomFromText('POINT(107 5)')),
+ ('h', 'a', 'b', GeomFromText('POINT(183 166)')),
+ ('m', 'w', 'p', GeomFromText('POINT(19 59)')),
+ ('b', 'y', 'o', GeomFromText('POINT(178 30)')),
+ ('x', 'w', 'i', GeomFromText('POINT(168 94)')),
+ ('t', 'k', 'z', GeomFromText('POINT(171 5)')),
+ ('r', 'm', 'a', GeomFromText('POINT(222 19)')),
+ ('u', 'v', 'e', GeomFromText('POINT(224 80)')),
+ ('q', 'r', 'k', GeomFromText('POINT(212 218)')),
+ ('d', 'p', 'j', GeomFromText('POINT(169 7)')),
+ ('d', 'r', 'v', GeomFromText('POINT(193 23)')),
+ ('n', 'y', 'y', GeomFromText('POINT(130 178)')),
+ ('m', 'z', 'r', GeomFromText('POINT(81 200)')),
+ ('j', 'e', 'w', GeomFromText('POINT(145 239)')),
+ ('v', 'h', 'x', GeomFromText('POINT(24 105)')),
+ ('z', 'm', 'a', GeomFromText('POINT(175 129)')),
+ ('b', 'c', 'v', GeomFromText('POINT(213 10)')),
+ ('t', 't', 'u', GeomFromText('POINT(2 129)')),
+ ('r', 's', 'v', GeomFromText('POINT(209 192)')),
+ ('x', 'p', 'g', GeomFromText('POINT(43 63)')),
+ ('t', 'e', 'u', GeomFromText('POINT(139 210)')),
+ ('l', 'e', 't', GeomFromText('POINT(245 148)')),
+ ('a', 'i', 'k', GeomFromText('POINT(167 195)')),
+ ('m', 'o', 'h', GeomFromText('POINT(206 120)')),
+ ('g', 'z', 's', GeomFromText('POINT(169 240)')),
+ ('z', 'u', 's', GeomFromText('POINT(202 120)')),
+ ('i', 'b', 'a', GeomFromText('POINT(216 18)')),
+ ('w', 'y', 'g', GeomFromText('POINT(119 236)')),
+ ('h', 'y', 'p', GeomFromText('POINT(161 24)'));
+UPDATE t1 set spatial_point=GeomFromText('POINT(33 100)') where c1 like 't%';
+UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%';
+CHECK TABLE t1 EXTENDED;
+DROP TABLE t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 7ae6e3adda7..3845bdcb983 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -1,5 +1,6 @@
-- source include/have_geometry.inc
+
#
# Spatial objects
#
@@ -423,6 +424,14 @@ from t1;
drop table t1;
+#
+# Bug #27164: Crash when mixing InnoDB and MyISAM Geospatial tables
+#
+CREATE TABLE t1(a POINT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
--echo End of 4.1 tests
#
@@ -472,6 +481,87 @@ insert into t1 values(default);
drop table t1;
#
+# Bug #27300: create view with geometry functions lost columns types
+#
+CREATE TABLE t1 (a GEOMETRY);
+CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
+CREATE VIEW v2 AS SELECT a FROM t1;
+DESCRIBE v1;
+DESCRIBE v2;
+
+DROP VIEW v1,v2;
+DROP TABLE t1;
+
+#
+# Bug#24563: MBROverlaps does not seem to function propertly
+# Bug#54888: MBROverlaps missing in 5.1?
+#
+
+# Test all MBR* functions and their non-MBR-prefixed aliases,
+# using shifted squares to verify the spatial relations.
+
+create table t1 (name VARCHAR(100), square GEOMETRY);
+
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+
+# Overlaps needs a few more tests, with point and line dimensions
+
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
+
+
+#
# Bug #11335 View redefines column types
#
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
@@ -480,3 +570,4 @@ desc v1;
drop view v1;
drop table t1;
+--echo End of 5.1 tests
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 9417ac687d4..cf4e2d0151e 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -3,6 +3,8 @@
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
+SET GLOBAL log_bin_trust_function_creators = 1;
+
# Cleanup
--disable_warnings
drop table if exists t1;
@@ -985,4 +987,243 @@ GRANT PROCESS ON * TO user@localhost;
disconnect con1;
connection default;
+
+#
+# BUG#9504: Stored procedures: execute privilege doesn't make 'use database'
+# okay.
+#
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
+DROP DATABASE IF EXISTS mysqltest4;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE DATABASE mysqltest3;
+CREATE DATABASE mysqltest4;
+
+CREATE PROCEDURE mysqltest1.p_def() SQL SECURITY DEFINER
+ SELECT 1;
+
+CREATE PROCEDURE mysqltest2.p_inv() SQL SECURITY INVOKER
+ SELECT 1;
+
+CREATE FUNCTION mysqltest3.f_def() RETURNS INT SQL SECURITY DEFINER
+ RETURN 1;
+
+CREATE FUNCTION mysqltest4.f_inv() RETURNS INT SQL SECURITY INVOKER
+ RETURN 1;
+
+GRANT EXECUTE ON PROCEDURE mysqltest1.p_def TO mysqltest_1@localhost;
+GRANT EXECUTE ON PROCEDURE mysqltest2.p_inv TO mysqltest_1@localhost;
+GRANT EXECUTE ON FUNCTION mysqltest3.f_def TO mysqltest_1@localhost;
+GRANT EXECUTE ON FUNCTION mysqltest4.f_inv TO mysqltest_1@localhost;
+
+GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
+
+# Test.
+
+--connect (bug9504_con1,localhost,mysqltest_1,,)
+--echo
+--echo ---> connection: bug9504_con1
+
+# - Check that we can switch to the db;
+
+use mysqltest1;
+
+use mysqltest2;
+
+use mysqltest3;
+
+use mysqltest4;
+
+# - Check that we can call stored routines;
+
+use test;
+
+CALL mysqltest1.p_def();
+
+CALL mysqltest2.p_inv();
+
+SELECT mysqltest3.f_def();
+
+SELECT mysqltest4.f_inv();
+
+# Cleanup.
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect bug9504_con1
+
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP DATABASE mysqltest3;
+DROP DATABASE mysqltest4;
+
+DROP USER mysqltest_1@localhost;
+
+
+#
+# BUG#27337: Privileges are not restored properly.
+#
+# Actually, the patch for this bugs fixes two problems. So, here are two test
+# cases.
+
+# Test case 1: privileges are not restored properly after calling a stored
+# routine defined with SQL SECURITY INVOKER clause.
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+
+GRANT ALL PRIVILEGES ON mysqltest1.* TO mysqltest_1@localhost;
+GRANT SELECT ON mysqltest2.* TO mysqltest_1@localhost;
+
+CREATE PROCEDURE mysqltest1.p1() SQL SECURITY INVOKER
+ SELECT 1;
+
+# Test.
+
+--connect (bug27337_con1,localhost,mysqltest_1,,mysqltest2)
+--echo
+--echo ---> connection: bug27337_con1
+
+--error ER_TABLEACCESS_DENIED_ERROR
+CREATE TABLE t1(c INT);
+
+CALL mysqltest1.p1();
+
+--error ER_TABLEACCESS_DENIED_ERROR
+CREATE TABLE t1(c INT);
+
+--disconnect bug27337_con1
+
+--connect (bug27337_con2,localhost,mysqltest_1,,mysqltest2)
+--echo
+--echo ---> connection: bug27337_con2
+
+--error ER_TABLEACCESS_DENIED_ERROR
+CREATE TABLE t1(c INT);
+
+SHOW TABLES;
+
+# Cleanup.
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect bug27337_con2
+
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+
+DROP USER mysqltest_1@localhost;
+
+# Test case 2: priveleges are not checked properly for prepared statements.
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+
+CREATE TABLE mysqltest1.t1(c INT);
+CREATE TABLE mysqltest2.t2(c INT);
+
+GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost;
+GRANT SELECT ON mysqltest2.t2 TO mysqltest_2@localhost;
+
+# Test.
+
+--connect (bug27337_con1,localhost,mysqltest_1,,mysqltest1)
+--echo
+--echo ---> connection: bug27337_con1
+
+SHOW TABLES FROM mysqltest1;
+
+PREPARE stmt1 FROM 'SHOW TABLES FROM mysqltest1';
+
+EXECUTE stmt1;
+
+--connect (bug27337_con2,localhost,mysqltest_2,,mysqltest2)
+--echo
+--echo ---> connection: bug27337_con2
+
+SHOW COLUMNS FROM mysqltest2.t2;
+
+PREPARE stmt2 FROM 'SHOW COLUMNS FROM mysqltest2.t2';
+
+EXECUTE stmt2;
+
+--connection default
+--echo
+--echo ---> connection: default
+
+REVOKE SELECT ON mysqltest1.t1 FROM mysqltest_1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest_2@localhost;
+
+--connection bug27337_con1
+--echo
+--echo ---> connection: bug27337_con1
+
+--error ER_DBACCESS_DENIED_ERROR
+SHOW TABLES FROM mysqltest1;
+
+--error ER_DBACCESS_DENIED_ERROR
+EXECUTE stmt1;
+
+--connection bug27337_con2
+--echo
+--echo ---> connection: bug27337_con2
+
+--error ER_TABLEACCESS_DENIED_ERROR
+SHOW COLUMNS FROM mysqltest2.t2;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+EXECUTE stmt2;
+
+# Cleanup.
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect bug27337_con2
+
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+
+DROP USER mysqltest_1@localhost;
+
+
--echo End of 5.0 tests
+
+#
+# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
+#
+set names utf8;
+grant select on test.* to юзер_юзер@localhost;
+--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
+revoke all on test.* from юзер_юзер@localhost;
+drop user юзер_юзер@localhost;
+--error 1573
+grant select on test.* to очень_длинный_юзер@localhost;
+set names default;
diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test
index c2e31621744..10e571fc5f5 100644
--- a/mysql-test/t/grant_cache.test
+++ b/mysql-test/t/grant_cache.test
@@ -1,6 +1,8 @@
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
-- source include/have_query_cache.inc
+# See at the end of the test why we disable the ps protocol (*)
+-- disable_ps_protocol
--source include/add_anonymous_users.inc
@@ -157,3 +159,27 @@ set GLOBAL query_cache_size=default;
# End of 4.1 tests
+
+# (*) Why we disable the ps protocol: because in normal protocol,
+# a SELECT failing due to insufficient privileges increments
+# Qcache_not_cached, while in ps-protocol, no.
+# In detail: in normal protocol,
+# the "access denied" errors on SELECT are issued at (stack trace):
+# mysql_parse/mysql_execute_command/execute_sqlcom_select/handle_select/
+# mysql_select/JOIN::prepare/setup_wild/insert_fields/
+# check_grant_all_columns/my_error/my_message_sql, which then calls
+# push_warning/query_cache_abort: at this moment,
+# query_cache_store_query() has been called, so query exists in cache,
+# so thd->net.query_cache_query!=NULL, so query_cache_abort() removes
+# the query from cache, which causes a query_cache.refused++ (thus,
+# a Qcache_not_cached++).
+# While in ps-protocol, the error is issued at prepare time;
+# for this mysql_test_select() is called, not execute_sqlcom_select()
+# (and that also leads to JOIN::prepare/etc). Thus, as
+# query_cache_store_query() has not been called,
+# thd->net.query_cache_query==NULL, so query_cache_abort() does nothing:
+# Qcache_not_cached is not incremented.
+# As this test prints Qcache_not_cached after SELECT failures,
+# we cannot enable this test in ps-protocol.
+
+--enable_ps_protocol
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 76e4af8f610..fb9c09d4763 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -755,12 +755,73 @@ SET SQL_MODE = '';
#
# 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;
+# optimizer does not honor IGNORE INDEX.
+# a.k.a WL3527.
+#
+CREATE TABLE t1 (a INT, b INT,
+ PRIMARY KEY (a),
+ KEY i2(a,b));
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
+INSERT INTO t1 SELECT a + 8,b FROM t1;
+INSERT INTO t1 SELECT a + 16,b FROM t1;
+INSERT INTO t1 SELECT a + 32,b FROM t1;
+INSERT INTO t1 SELECT a + 64,b FROM t1;
+INSERT INTO t1 SELECT a + 128,b FROM t1;
+ANALYZE TABLE t1;
+EXPLAIN SELECT a FROM t1 WHERE a < 2;
+EXPLAIN SELECT a FROM t1 WHERE a < 2 ORDER BY a;
+EXPLAIN SELECT a FROM t1 WHERE a < 2 GROUP BY a;
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY,i2);
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2);
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
+ IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY) IGNORE INDEX FOR ORDER BY (i2);
+EXPLAIN SELECT a FROM t1 FORCE INDEX (i2);
+EXPLAIN SELECT a FROM t1 USE INDEX ();
+EXPLAIN SELECT a FROM t1 USE INDEX () USE INDEX (i2);
+--error ER_WRONG_USAGE
+EXPLAIN SELECT a FROM t1
+ FORCE INDEX (PRIMARY)
+ IGNORE INDEX FOR GROUP BY (i2)
+ IGNORE INDEX FOR ORDER BY (i2)
+ USE INDEX (i2);
+EXPLAIN SELECT a FROM t1 USE INDEX (i2) USE INDEX ();
+--error ER_PARSE_ERROR
+EXPLAIN SELECT a FROM t1 FORCE INDEX ();
+--error ER_PARSE_ERROR
+EXPLAIN SELECT a FROM t1 IGNORE INDEX ();
+EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2)
+ USE INDEX FOR GROUP BY (i2) GROUP BY a;
+EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2)
+ FORCE INDEX FOR GROUP BY (i2) GROUP BY a;
+EXPLAIN SELECT a FROM t1 USE INDEX () IGNORE INDEX (i2);
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (i2) USE INDEX ();
+
+EXPLAIN SELECT a FROM t1
+ USE INDEX FOR GROUP BY (i2)
+ USE INDEX FOR ORDER BY (i2)
+ USE INDEX FOR JOIN (i2);
+
+EXPLAIN SELECT a FROM t1
+ USE INDEX FOR JOIN (i2)
+ USE INDEX FOR JOIN (i2)
+ USE INDEX FOR JOIN (i2,i2);
+
+EXPLAIN SELECT 1 FROM t1 WHERE a IN
+ (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
+
+CREATE TABLE t2 (a INT, b INT, KEY(a));
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
+EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
+EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2;
+
+EXPLAIN SELECT 1 FROM t2 WHERE a IN
+ (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
+
+SHOW VARIABLES LIKE 'old';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@old = off;
-DROP TABLE t1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index 624597cd8d7..b47a5fc2033 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -471,3 +471,12 @@ SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
DROP TABLE t1;
# End of 5.0 tests
+
+#
+# BUG#26080 - Memory Storage engine not working properly
+#
+CREATE TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('', 0);
+ALTER TABLE t1 MODIFY c1 VARCHAR(101);
+SELECT c2 FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
index 68aa79834fc..4e7102806d6 100644
--- a/mysql-test/t/heap_btree.test
+++ b/mysql-test/t/heap_btree.test
@@ -182,6 +182,37 @@ delete from t1 where a >= 2;
select a from t1 order by a;
drop table t1;
+#
+# Bug#26996 - Update of a Field in a Memory Table ends with wrong result
+#
+CREATE TABLE t1 (
+ c1 CHAR(3),
+ c2 INTEGER,
+ KEY USING BTREE(c1),
+ KEY USING BTREE(c2)
+) ENGINE= MEMORY;
+INSERT INTO t1 VALUES ('ABC',0), ('A',0), ('B',0), ('C',0);
+UPDATE t1 SET c2= c2 + 1 WHERE c1 = 'A';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
+# causes incorrect duplicate entries
+#
+CREATE TABLE t1 (
+ c1 ENUM('1', '2'),
+ UNIQUE USING BTREE(c1)
+) ENGINE= MEMORY DEFAULT CHARSET= utf8;
+INSERT INTO t1 VALUES('1'), ('2');
+DROP TABLE t1;
+CREATE TABLE t1 (
+ c1 SET('1', '2'),
+ UNIQUE USING BTREE(c1)
+) ENGINE= MEMORY DEFAULT CHARSET= utf8;
+INSERT INTO t1 VALUES('1'), ('2');
+DROP TABLE t1;
+
--echo End of 4.1 tests
#
@@ -205,3 +236,4 @@ INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
--echo End of 5.0 tests
+
diff --git a/mysql-test/t/help.test b/mysql-test/t/help.test
index ff431fb4ebd..71821e46771 100644
--- a/mysql-test/t/help.test
+++ b/mysql-test/t/help.test
@@ -13,30 +13,30 @@
# impossible_category_3
# impossible_function_7
-insert into mysql.help_category(help_category_id,name)values(1,'impossible_category_1');
-select @category1_id:= 1;
-insert into mysql.help_category(help_category_id,name)values(2,'impossible_category_2');
-select @category2_id:= 2;
-insert into mysql.help_category(help_category_id,name,parent_category_id)values(3,'impossible_category_3',@category2_id);
-select @category3_id:= 3;
-
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(1,'impossible_function_1',@category1_id,'description of \n impossible_function1\n','example of \n impossible_function1');
-select @topic1_id:= 1;
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(2,'impossible_function_2',@category1_id,'description of \n impossible_function2\n','example of \n impossible_function2');
-select @topic2_id:= 2;
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(3,'impossible_function_3',@category2_id,'description of \n impossible_function3\n','example of \n impossible_function3');
-select @topic3_id:= 3;
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(4,'impossible_function_4',@category2_id,'description of \n impossible_function4\n','example of \n impossible_function4');
-select @topic4_id:= 4;
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(5,'impossible_function_7',@category3_id,'description of \n impossible_function5\n','example of \n impossible_function7');
-select @topic5_id:= 5;
-
-insert into mysql.help_keyword(help_keyword_id,name)values(1,'impossible_function_1');
-select @keyword1_id:= 1;
-insert into mysql.help_keyword(help_keyword_id,name)values(2,'impossible_function_5');
-select @keyword2_id:= 2;
-insert into mysql.help_keyword(help_keyword_id,name)values(3,'impossible_function_6');
-select @keyword3_id:= 3;
+insert into mysql.help_category(help_category_id,name)values(10001,'impossible_category_1');
+select @category1_id:= 10001;
+insert into mysql.help_category(help_category_id,name)values(10002,'impossible_category_2');
+select @category2_id:= 10002;
+insert into mysql.help_category(help_category_id,name,parent_category_id)values(10003,'impossible_category_3',@category2_id);
+select @category3_id:= 10003;
+
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10101,'impossible_function_1',@category1_id,'description of \n impossible_function1\n','example of \n impossible_function1');
+select @topic1_id:= 10101;
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10102,'impossible_function_2',@category1_id,'description of \n impossible_function2\n','example of \n impossible_function2');
+select @topic2_id:= 10102;
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10103,'impossible_function_3',@category2_id,'description of \n impossible_function3\n','example of \n impossible_function3');
+select @topic3_id:= 10103;
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10104,'impossible_function_4',@category2_id,'description of \n impossible_function4\n','example of \n impossible_function4');
+select @topic4_id:= 10104;
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10105,'impossible_function_7',@category3_id,'description of \n impossible_function5\n','example of \n impossible_function7');
+select @topic5_id:= 10105;
+
+insert into mysql.help_keyword(help_keyword_id,name)values(10201,'impossible_function_1');
+select @keyword1_id:= 10201;
+insert into mysql.help_keyword(help_keyword_id,name)values(10202,'impossible_function_5');
+select @keyword2_id:= 10202;
+insert into mysql.help_keyword(help_keyword_id,name)values(10203,'impossible_function_6');
+select @keyword3_id:= 10203;
insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword1_id,@topic2_id);
insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword2_id,@topic1_id);
@@ -114,4 +114,25 @@ delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topi
delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id;
delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id;
-# End of 4.1 tests
+--echo End of 4.1 tests.
+
+#
+# Test that we can use HELP even under LOCK TABLES. See bug#9953:
+# CONVERT_TZ requires mysql.time_zone_name to be locked.
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+
+LOCK TABLES t1 WRITE;
+
+HELP no_such_topic;
+
+UNLOCK TABLES;
+
+DROP TABLE t1;
+
+
+--echo End of 5.1 tests.
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 09a588c9195..a49044e63c1 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1042,5 +1042,39 @@ select user,db from information_schema.processlist;
connection default;
drop user user3148@localhost;
---echo End of 5.1 tests.
+#
+# Bug #26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS
+# in Event (see also openssl_1.test)
+#
+--disable_warnings
+DROP TABLE IF EXISTS server_status;
+DROP EVENT IF EXISTS event_status;
+--enable_warnings
+
+SET GLOBAL event_scheduler=1;
+
+DELIMITER $$;
+CREATE EVENT event_status
+ ON SCHEDULE AT NOW()
+ ON COMPLETION NOT PRESERVE
+ DO
+BEGIN
+ CREATE TABLE server_status
+ SELECT variable_name
+ FROM information_schema.global_status
+ WHERE variable_name LIKE 'ABORTED_CONNECTS' OR
+ variable_name LIKE 'BINLOG_CACHE_DISK_USE';
+END$$
+
+DELIMITER ;$$
+
+let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_status';
+--source include/wait_condition.inc
+
+SELECT variable_name FROM server_status;
+
+DROP TABLE server_status;
+SET GLOBAL event_scheduler=0;
+
+--echo End of 5.1 tests.
diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test
index e15e50e8766..666f331c7b9 100644
--- a/mysql-test/t/information_schema_db.test
+++ b/mysql-test/t/information_schema_db.test
@@ -121,6 +121,28 @@ create table t1 (f1 char(4));
create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
+create view v5 as select f1 from t1;
+grant show view on v5 to testdb_2@localhost;
+
+--error 1227
+create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
+
+connection default;
+use testdb_1;
+create view v6 as select f1 from t1;
+grant show view on v6 to testdb_2@localhost;
+
+create table t2 (f1 char(4));
+create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
+
+show fields from testdb_1.v6;
+show create view testdb_1.v6;
+
+show create view testdb_1.v7;
+show fields from testdb_1.v7;
+
+connection testdb_1;
+
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
@@ -129,13 +151,41 @@ connect (testdb_2,localhost,testdb_2,,test);
create view v2 as select f1 from testdb_1.v1;
create view v4 as select f1,f2 from testdb_1.v3;
+show fields from testdb_1.v5;
+show create view testdb_1.v5;
+
+show fields from testdb_1.v6;
+show create view testdb_1.v6;
+
connection testdb_1;
+show fields from testdb_1.v7;
+show create view testdb_1.v7;
+
revoke insert(f1) on v3 from testdb_2@localhost;
+revoke show view on v5 from testdb_2@localhost;
+connection default;
+use testdb_1;
+revoke show view on v6 from testdb_2@localhost;
connection testdb_2;
+--error 1142
+show fields from testdb_1.v5;
+--error 1142
+show create view testdb_1.v5;
+
+--error 1142
+show fields from testdb_1.v6;
+--error 1142
+show create view testdb_1.v6;
+
+--error 1142
+show fields from testdb_1.v7;
+--error 1142
+show create view testdb_1.v7;
+
--error 1345
show create view v4;
---error 1345
+#--error 1345
show fields from v4;
show fields from v2;
@@ -155,7 +205,8 @@ where a.table_name = 'testdb_1.v1';
select * from v2;
connection default;
-drop view testdb_1.v1,v2, testdb_1.v3, v4;
+use test;
+drop view testdb_1.v1, v2, testdb_1.v3, v4;
drop database testdb_1;
drop user testdb_1@localhost;
drop user testdb_2@localhost;
diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test
index c9a18a4003d..0a08559279c 100644
--- a/mysql-test/t/init_connect.test
+++ b/mysql-test/t/init_connect.test
@@ -2,10 +2,11 @@
# Test of init_connect variable
#
+# should work with embedded server after mysqltest is fixed
+--source include/not_embedded.inc
+
--source include/add_anonymous_users.inc
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
connect (con0,localhost,root,,);
connection con0;
select hex(@a);
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 0937b4fd30d..75f2796abc6 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1810,7 +1810,6 @@ select a,hex(s1) from t1;
select hex(s1) from t2;
drop table t2,t1;
-
# Ensure that <tablename>_ibfk_0 is not mistreated as a
# generated foreign key identifier. (Bug #16387)
@@ -2293,6 +2292,34 @@ DELETE CASCADE ON UPDATE CASCADE;
SHOW CREATE TABLE t2;
DROP TABLE t2, t1;
+#
+# Bug #25927: Prevent ALTER TABLE ... MODIFY ... NOT NULL on columns
+# for which there is a foreign key constraint ON ... SET NULL.
+#
+
+CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
+--replace_regex /'\.\/test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error 1025
+ALTER TABLE t2 MODIFY a INT NOT NULL;
+DELETE FROM t1;
+DROP TABLE t2,t1;
+
+#
+# Bug #26835: table corruption after delete+insert
+#
+
+CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('DDD');
+SELECT * FROM t1;
+DROP TABLE t1;
+
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 0f9a0ca4872..95a55b732c5 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -293,4 +293,29 @@ INSERT INTO t2 (f1, f2)
SELECT * FROM t2;
DROP TABLE t1, t2;
-
+#
+# Bug #26207: inserts don't work with shortened index
+#
+SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
+
+CREATE TABLE t1 (c VARCHAR(30), INDEX ix_c (c(10)));
+CREATE TABLE t2 (d VARCHAR(10));
+INSERT INTO t1 (c) VALUES ('7_chars'), ('13_characters');
+
+EXPLAIN
+ SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
+
+SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
+
+INSERT INTO t2 (d)
+ SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
+
+INSERT INTO t2 (d)
+ SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='7_chars') FROM t1;
+
+INSERT INTO t2 (d)
+ SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c IN (SELECT t1.c FROM t1))
+ FROM t1;
+
+SELECT * FROM t2;
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test
index 4c6d22a98cb..f0d87ea956d 100644
--- a/mysql-test/t/insert_update.test
+++ b/mysql-test/t/insert_update.test
@@ -162,3 +162,88 @@ INSERT INTO t2 VALUES (1), (3);
--error ER_BAD_FIELD_ERROR
INSERT INTO t1 SELECT 1, COUNT(*) FROM t2 ON DUPLICATE KEY UPDATE j= a;
DROP TABLE t1,t2;
+
+#
+# Bug #26261: Missing default value isn't noticed in
+# insert ... on duplicate key update
+#
+SET SQL_MODE = 'TRADITIONAL';
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL);
+
+--error 1364
+INSERT INTO t1 (a) VALUES (1);
+
+--error 1364
+INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b;
+
+--error 1364
+INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b;
+
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+#
+# Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
+# touched but not actually changed.
+#
+CREATE TABLE t1 (f1 INT AUTO_INCREMENT PRIMARY KEY,
+ f2 VARCHAR(5) NOT NULL UNIQUE);
+INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
+SELECT LAST_INSERT_ID();
+INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
+SELECT LAST_INSERT_ID();
+DROP TABLE t1;
+
+#
+# Bug#23233: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE in the
+# NO_AUTO_VALUE_ON_ZERO mode.
+#
+SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
+CREATE TABLE `t1` (
+ `id` int(11) PRIMARY KEY auto_increment,
+ `f1` varchar(10) NOT NULL UNIQUE
+);
+INSERT IGNORE INTO t1 (f1) VALUES ("test1")
+ ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+INSERT IGNORE INTO t1 (f1) VALUES ("test1")
+ ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+INSERT IGNORE INTO t1 (f1) VALUES ("test2")
+ ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT * FROM t1;
+INSERT IGNORE INTO t1 (f1) VALUES ("test2")
+ ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+INSERT IGNORE INTO t1 (f1) VALUES ("test3")
+ ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+DROP TABLE t1;
+CREATE TABLE `t1` (
+ `id` int(11) PRIMARY KEY auto_increment,
+ `f1` varchar(10) NOT NULL UNIQUE
+);
+INSERT IGNORE INTO t1 (f1) VALUES ("test1")
+ ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+INSERT IGNORE INTO t1 (f1) VALUES ("test1"),("test4")
+ ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+DROP TABLE t1;
+CREATE TABLE `t1` (
+ `id` int(11) PRIMARY KEY auto_increment,
+ `f1` varchar(10) NOT NULL UNIQUE,
+ tim1 timestamp default '2003-01-01 00:00:00' on update current_timestamp
+);
+INSERT INTO t1 (f1) VALUES ("test1");
+SELECT id, f1 FROM t1;
+REPLACE INTO t1 VALUES (0,"test1",null);
+SELECT id, f1 FROM t1;
+DROP TABLE t1;
+SET SQL_MODE='';
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index 1a53344c8ef..99736e0f11f 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -453,3 +453,51 @@ ALTER TABLE t1 DISABLE KEYS;
EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a);
drop table t1;
+
+#
+# Bug #24778: Innodb: No result when using ORDER BY
+#
+CREATE TABLE t1 (
+ a INTEGER auto_increment PRIMARY KEY,
+ b INTEGER NOT NULL,
+ c INTEGER NOT NULL,
+ d CHAR(64)
+);
+
+CREATE TABLE t2 (
+ a INTEGER auto_increment PRIMARY KEY,
+ b INTEGER NOT NULL,
+ c SMALLINT NOT NULL,
+ d DATETIME NOT NULL,
+ e SMALLINT NOT NULL,
+ f INTEGER NOT NULL,
+ g INTEGER NOT NULL,
+ h SMALLINT NOT NULL,
+ i INTEGER NOT NULL,
+ j INTEGER NOT NULL,
+ UNIQUE INDEX (b),
+ INDEX (b, d, e, f, g, h, i, j, c),
+ INDEX (c)
+);
+
+INSERT INTO t2 VALUES
+ (NULL, 1, 254, '1000-01-01 00:00:00', 257, 0, 0, 0, 0, 0),
+ (NULL, 2, 1, '2004-11-30 12:00:00', 1, 0, 0, 0, 0, 0),
+ (NULL, 3, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -21600, 0),
+ (NULL, 4, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -10800, 0),
+ (NULL, 5, 1, '2004-11-30 12:00:00', 1, 0, 0, 5, -10800, 0),
+ (NULL, 6, 1, '2004-11-30 12:00:00', 102, 0, 0, 0, 0, 0),
+ (NULL, 7, 1, '2004-11-30 12:00:00', 105, 2, 0, 0, 0, 0),
+ (NULL, 8, 1, '2004-11-30 12:00:00', 105, 10, 0, 0, 0, 0);
+
+INSERT INTO t1 (b, c, d) VALUES
+ (3388000, -553000, NULL),
+ (3388000, -553000, NULL);
+
+SELECT *
+FROM t2 c JOIN t1 pa ON c.b = pa.a
+WHERE c.c = 1
+ORDER BY c.b, c.d
+;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index b608ab601c1..6a6e59f6173 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -130,16 +130,32 @@ set @@secure_file_priv= 0;
truncate table t1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1290
-eval load data infile '$MYSQL_TEST_DIR/Makefile' into table t1;
+eval load data infile '$MYSQL_TEST_DIR/t/loaddata.test' into table t1;
select * from t1;
# Test "load_file" returns NULL
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
-eval select load_file("$MYSQL_TEST_DIR/Makefile");
+eval select load_file("$MYSQL_TEST_DIR/t/loaddata.test");
# cleanup
drop table t1, t2;
+#
+# Bug#27586: Wrong autoinc value assigned by LOAD DATA in the
+# NO_AUTO_VALUE_ON_ZERO mode
+#
+create table t1(f1 int);
+insert into t1 values(1),(null);
+create table t2(f2 int auto_increment primary key);
+disable_query_log;
+eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t1' from t1;
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t2;
+enable_query_log;
+select * from t2;
+--exec rm $MYSQLTEST_VARDIR/tmp/t1
+SET @@SQL_MODE=@OLD_SQL_MODE;
+drop table t1,t2;
# End of 5.0 tests
diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test
index fb5e45433e9..2b8b430f096 100644
--- a/mysql-test/t/lock.test
+++ b/mysql-test/t/lock.test
@@ -92,7 +92,8 @@ delete from t2 using t1,t2 where t1.a=t2.a;
delete t2 from t1,t2 where t1.a=t2.a;
drop table t1,t2;
-# End of 4.1 tests
+--echo End of 4.1 tests.
+
#
# Bug#18884 "lock table + global read lock = crash"
@@ -108,3 +109,44 @@ flush tables with read lock;
unlock tables;
drop table t1;
+
+#
+# Test LOCK TABLE on system tables. See bug#9953: CONVERT_TZ requires
+# mysql.time_zone_name to be locked.
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+
+LOCK TABLES mysql.time_zone READ, mysql.proc READ, t1 READ;
+UNLOCK TABLES;
+
+LOCK TABLES mysql.time_zone READ, mysql.proc READ, t1 WRITE;
+UNLOCK TABLES;
+
+LOCK TABLES mysql.time_zone READ, mysql.proc READ;
+UNLOCK TABLES;
+
+LOCK TABLES mysql.time_zone WRITE, mysql.proc WRITE;
+UNLOCK TABLES;
+
+# If at least one system table is locked for WRITE, then all other
+# tables should be system tables locked also for WRITE.
+--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
+LOCK TABLES mysql.time_zone READ, mysql.proc WRITE, t1 READ;
+
+--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
+LOCK TABLES mysql.time_zone WRITE, mysql.proc WRITE, t1 READ;
+
+--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
+LOCK TABLES mysql.time_zone WRITE, mysql.proc WRITE, t1 WRITE;
+
+--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
+LOCK TABLES mysql.time_zone READ, mysql.proc WRITE;
+
+DROP TABLE t1;
+
+
+--echo End of 5.1 tests.
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
index a5e00cb0387..16f466e9b54 100644
--- a/mysql-test/t/log_state.test
+++ b/mysql-test/t/log_state.test
@@ -132,3 +132,7 @@ select * from mysql.general_log;
# Cleanup (must be done last to avoid delayed 'Quit' message in general log)
#
disconnect con1;
+
+# Remove the log files that was created in the "default location"
+# i.e var/run
+--remove_file $MYSQLTEST_VARDIR/run/master.log
diff --git a/mysql-test/t/log_tables-big-master.opt b/mysql-test/t/log_tables-big-master.opt
new file mode 100644
index 00000000000..35ff7911705
--- /dev/null
+++ b/mysql-test/t/log_tables-big-master.opt
@@ -0,0 +1 @@
+--log-slow-queries
diff --git a/mysql-test/t/log_tables-big.test b/mysql-test/t/log_tables-big.test
new file mode 100644
index 00000000000..8c956fa6f55
--- /dev/null
+++ b/mysql-test/t/log_tables-big.test
@@ -0,0 +1,35 @@
+# this test needs multithreaded mysqltest
+-- source include/not_embedded.inc
+
+# Test sleeps for long times
+--source include/big_test.inc
+
+# check that CSV engine was compiled in
+--source include/have_csv.inc
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+#
+# Bug #27638: slow logging to CSV table inserts bad query_time and lock_time values
+#
+connection con1;
+set session long_query_time=10;
+select get_lock('bug27638', 1);
+connection con2;
+set session long_query_time=1;
+truncate table mysql.slow_log;
+select get_lock('bug27638', 2);
+select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+truncate table mysql.slow_log;
+select get_lock('bug27638', 60);
+select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+truncate table mysql.slow_log;
+select get_lock('bug27638', 101);
+select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+connection con1;
+select release_lock('bug27638');
+connection default;
+
+disconnect con1;
+disconnect con2;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index d3639b07bdb..e150b6b3a9a 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -434,6 +434,23 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1;
DROP TABLE t1, tm1;
+
+# BUG#26881 - Large MERGE tables report incorrect specification when no
+# differences in tables
+#
+CREATE TABLE t1(c1 VARCHAR(1));
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+DROP TABLE t1, m1;
+
+CREATE TABLE t1(c1 VARCHAR(4), c2 TINYINT, c3 TINYINT, c4 TINYINT,
+ c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT, c9 TINYINT);
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+DROP TABLE t1, m1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/myisam-system.test b/mysql-test/t/myisam-system.test
index 43fbaabf698..c4a7651ac7d 100644
--- a/mysql-test/t/myisam-system.test
+++ b/mysql-test/t/myisam-system.test
@@ -7,14 +7,14 @@ drop table if exists t1,t2;
--enable_warnings
create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+--remove_file $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 ;
+--remove_file $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 ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
--error 1105,6,29
drop table t1;
--error 1051
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 4281030fc3c..8f7357d1c98 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -874,6 +874,150 @@ CREATE TABLE t1 (c1 TEXT) AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
+#
+# Bug#26231 - select count(*) on myisam table returns wrong value
+# when index is used
+#
+CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
+# Fill at least two key blocks. "Tab, A" must be in both blocks.
+INSERT INTO t1 VALUES
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
+ (''), (''), (''), (''),
+ (' B'), (' B'), (' B'), (' B');
+SELECT DISTINCT COUNT(*) FROM t1 WHERE c1 = '';
+SELECT DISTINCT length(c1), c1 FROM t1 WHERE c1 = '';
+SELECT DISTINCT COUNT(*) FROM t1 IGNORE INDEX (c1) WHERE c1 = '';
+SELECT DISTINCT length(c1), c1 FROM t1 IGNORE INDEX (c1) WHERE c1 = '';
+SELECT DISTINCT length(c1), c1 FROM t1 ORDER BY c1;
+DROP TABLE t1;
+
--echo End of 4.1 tests
diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test
index 5d44ab63f12..5a5b7646cf4 100644
--- a/mysql-test/t/mysqlbinlog-cp932.test
+++ b/mysql-test/t/mysqlbinlog-cp932.test
@@ -1,3 +1,6 @@
+# disabled in embedded until tools running is fixed with embedded
+--source include/not_embedded.inc
+
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_cp932.inc
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 9a27c4cbdb2..e4cbd2938fb 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -65,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=235 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLTEST_VARDIR/log/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -97,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=235 --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=239 --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
@@ -204,8 +204,8 @@ load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8
select hex(a) from t1;
drop table t1;
flush logs;
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000010
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000010
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index 85a678055d4..ac647f772b1 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -52,11 +52,15 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=604 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001
+--disable_query_log
+select "--- start and stop positions ---" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLTEST_VARDIR/log/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -82,11 +86,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=608 $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=130 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -109,11 +113,15 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---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
+--exec $MYSQL_BINLOG --short-form --start-position=608 --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=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--disable_query_log
+select "--- start and stop positions ---" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 --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
@@ -136,11 +144,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---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
+--exec $MYSQL_BINLOG --short-form --start-position=608 --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=130 --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=134 --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/mysqldump.test b/mysql-test/t/mysqldump.test
index d9372ad35c1..49adda73f2d 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -919,7 +919,7 @@ port=1234
EOF
--exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1
--exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
---remov_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
+--remove_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
--echo #
--echo # Test of fix to BUG 12597
@@ -1431,6 +1431,72 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#26346: stack + buffer overrun in mysqldump
+--echo #
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2);
+
+# too long a file path causes an error
+--error 1
+--exec $MYSQL_DUMP --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test 2>&1
+
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-optionally-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --lines-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+
+--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
+
+DROP TABLE t1;
+
+#
+# Bug #25993: crashe with a merge table and -c
+#
+
+CREATE TABLE t2 (a int);
+CREATE TABLE t3 (a int);
+CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
+--exec $MYSQL_DUMP --skip-comments -c test
+DROP TABLE t1, t2, t3;
+
+--echo #
+--echo # Bug #23491: MySQLDump prefix function call in a view by database name
+--echo #
+
+# Setup
+create database bug23491_original;
+create database bug23491_restore;
+use bug23491_original;
+create table t1 (c1 int);
+create view v1 as select * from t1;
+create procedure p1() select 1;
+create function f1() returns int return 1;
+create view v2 as select f1();
+create function f2() returns int return f1();
+create view v3 as select bug23491_original.f1();
+
+# Backup.
+--exec $MYSQL_DUMP --skip-comments -uroot --opt --routines bug23491_original > $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
+
+# Restore.
+--exec $MYSQL bug23491_restore < $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
+
+# Verify
+use bug23491_restore;
+show create view bug23491_restore.v2;
+show create view bug23491_restore.v3;
+
+# Cleanup
+drop database bug23491_original;
+drop database bug23491_restore;
+use test;
+
--echo #
--echo # End of 5.0 tests
--echo #
diff --git a/mysql-test/t/mysqlslap.test b/mysql-test/t/mysqlslap.test
index 01add0d7da8..2a7bbfed932 100644
--- a/mysql-test/t/mysqlslap.test
+++ b/mysql-test/t/mysqlslap.test
@@ -4,7 +4,7 @@
--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 --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql
--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=";"
@@ -14,3 +14,25 @@
--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
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --create-schema=test_env --auto-generate-sql-add-autoincrement
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=update
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=read
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=mixed
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=update
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=update --auto-generate-sql-execute-number=5
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=key --auto-generate-sql-execute-number=5
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=key --auto-generate-sql-execute-number=5 --auto-generate-sql-secondary-indexes=3
+
+--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" --post-query="SHOW TABLES" --pre-query="SHOW TABLES";
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index 7424687cd8a..06d47693c10 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -24,7 +24,7 @@ create table t1(
insert into t1 values(1, "Autodiscover");
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
select * from t1;
show status like 'handler_discover%';
@@ -33,13 +33,13 @@ show status like 'handler_discover%';
#
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
insert into t1 values (2, "Auto 2");
show status like 'handler_discover%';
insert into t1 values (3, "Discover 3");
show status like 'handler_discover%';
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
select * from t1 order by id;
show status like 'handler_discover%';
@@ -48,7 +48,7 @@ show status like 'handler_discover%';
#
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
update t1 set name="Autodiscover" where id = 2;
show status like 'handler_discover%';
select * from t1 order by id;
@@ -59,7 +59,7 @@ show status like 'handler_discover%';
#
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
delete from t1 where id = 3;
select * from t1 order by id;
show status like 'handler_discover%';
@@ -111,7 +111,7 @@ show status like 'handler_discover%';
flush tables;
# Remove the frm file from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm
--error 1050
create table t3(
@@ -168,14 +168,14 @@ show status like 'handler_discover%';
# Remove the frm file from disk
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
show tables from test;
show status like 'handler_discover%';
# Remove the frm file from disk again
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
--replace_column 6 # 7 # 8 # 9 # 12 # 13 # 15 # 18 #
show table status;
@@ -290,8 +290,8 @@ insert into t9 values (9);
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ;
# Remove t6, t7 from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
SHOW TABLES;
@@ -332,8 +332,8 @@ insert into t9 values (9);
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
# Remove t6, t7 from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
SHOW TABLES LIKE 't6';
@@ -375,9 +375,9 @@ insert into t3 values (3, "ndb table 3");
insert into t4 values (4);
# Remove t1, t2, t3 from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm > /dev/null ;
-system rm $MYSQLTEST_VARDIR/master-data/test/t2.frm > /dev/null ;
-system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm > /dev/null ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t2.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm
flush tables;
# Select from the table which only exists in NDB.
@@ -530,7 +530,7 @@ CREATE TABLE t9 (
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
#Don't drop the table, instead remove the frm file
-system rm $MYSQLTEST_VARDIR/master-data/test/t9.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t9.frm
# Now leave test case, when ndb_autodiscover2 will run, this
# MySQL Server will have been restarted because it has a
diff --git a/mysql-test/t/ndb_autodiscover3.test b/mysql-test/t/ndb_autodiscover3.test
index ae6d669c3b8..d0b9d0983e9 100644
--- a/mysql-test/t/ndb_autodiscover3.test
+++ b/mysql-test/t/ndb_autodiscover3.test
@@ -1,5 +1,6 @@
-- source include/have_ndb.inc
-- source include/have_multi_ndb.inc
+-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
# see bug#21563
@@ -9,6 +10,11 @@
drop table if exists t1, t2;
--enable_warnings
+# Workaround for Bug#27644
+# ndb: connecting api node/mysqld may "steal" node_id from running mysqld
+# - let ndb_waiter use a fixed node id so "steal" cannot happen
+--let connect_str = "nodeid=6;$NDB_CONNECTSTRING"
+
#
# Transaction ongoing while cluster is restarted
#
@@ -19,7 +25,7 @@ begin;
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
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
# Wait for mysqld to reconnect and exit from readonly mode
# Should preferrably be a "while (!"select ndb_readonly")" loop
sleep 2;
@@ -39,7 +45,7 @@ insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,
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
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $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 ndb_apply_status >> $NDB_TOOLS_OUTPUT
sleep 2;
@@ -58,7 +64,7 @@ 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
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $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 ndb_apply_status >> $NDB_TOOLS_OUTPUT
sleep 2;
diff --git a/mysql-test/t/ndb_binlog_ddl_multi.test b/mysql-test/t/ndb_binlog_ddl_multi.test
index 064bd88764a..487dfbf16e5 100644
--- a/mysql-test/t/ndb_binlog_ddl_multi.test
+++ b/mysql-test/t/ndb_binlog_ddl_multi.test
@@ -31,10 +31,10 @@ 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
+--source include/show_binlog_events2.inc
--connection server1
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
# alter table
--connection server1
@@ -46,7 +46,7 @@ reset master;
alter table t2 add column (b int);
--connection server1
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
# alter database
--connection server1
@@ -64,10 +64,10 @@ ALTER DATABASE mysqltest CHARACTER SET latin1;
drop table mysqltest.t1;
--connection server1
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
# to track down bug#18976
--real_sleep 10
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
#--connection server2
#drop table mysqltest.t1;
@@ -85,7 +85,7 @@ drop database mysqltest;
create table t1 (a int primary key) engine=ndb;
--connection server2
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
--connection server2
drop table t2;
@@ -137,10 +137,10 @@ ENGINE =NDB;
#drop table t1;
--connection server2
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
# to track down bug#18976
--real_sleep 10
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
drop table t1;
@@ -161,7 +161,7 @@ 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
+--source include/show_binlog_events2.inc
drop table t1;
drop table t2;
@@ -188,4 +188,4 @@ insert into t2 values(2);
# prior to bug fix, data was missing for t2
--connection server2
drop table t2;
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
diff --git a/mysql-test/t/ndb_binlog_discover.test b/mysql-test/t/ndb_binlog_discover.test
index 88126cc1c23..999079ad29c 100644
--- a/mysql-test/t/ndb_binlog_discover.test
+++ b/mysql-test/t/ndb_binlog_discover.test
@@ -29,5 +29,8 @@ while ($mysql_errno)
}
--enable_query_log
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
+PURGE MASTER LOGS TO 'master-bin.000002';
+
+--source include/show_binlog_events2.inc
drop table t1;
diff --git a/mysql-test/t/ndb_binlog_ignore_db.test b/mysql-test/t/ndb_binlog_ignore_db.test
index a99dfd940ad..8f80e53f2e4 100644
--- a/mysql-test/t/ndb_binlog_ignore_db.test
+++ b/mysql-test/t/ndb_binlog_ignore_db.test
@@ -11,6 +11,6 @@ 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
+-- source include/show_binlog_events2.inc
drop database mysqltest;
diff --git a/mysql-test/t/ndb_binlog_log_bin.test b/mysql-test/t/ndb_binlog_log_bin.test
new file mode 100644
index 00000000000..b2dbaa797b6
--- /dev/null
+++ b/mysql-test/t/ndb_binlog_log_bin.test
@@ -0,0 +1,50 @@
+-- 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;
+reset master;
+connection server1;
+drop table if exists t1,t2,t3;
+reset master;
+--enable_warnings
+
+# basic SQL_LOG_BIN functionality
+# see updates from one thread but not the other
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+# do some stuff with SQL_LOG_BIN=0
+connection con2;
+set SQL_LOG_BIN=0;
+create database mysqltest;
+use mysqltest;
+create table t1 (a int key, b int) engine=ndb;
+create table t2 (a int key, b int) engine=ndb;
+insert into t1 values (1,1);
+alter table t1 add c int;
+# we should not see it in the local server
+-- source include/show_binlog_events2.inc
+reset master;
+# we should not see it in another server
+connection server2;
+use mysqltest;
+insert into t2 values (1,1);
+-- source include/show_binlog_events2.inc
+reset master;
+# but if you do stuff in "default" client setting
+connection con1;
+use mysqltest;
+drop table t1;
+drop table t2;
+create table t1 (d int key, e int) engine=ndb;
+create table t2 (d int key, e int) engine=ndb;
+insert into t1 values (1,1);
+-- source include/show_binlog_events2.inc
+# and in another server
+connection server2;
+use mysqltest;
+insert into t2 values (1,1);
+-- source include/show_binlog_events2.inc
+drop database mysqltest;
diff --git a/mysql-test/t/ndb_binlog_multi.test b/mysql-test/t/ndb_binlog_multi.test
index 1f04787e27c..c227c7fec93 100644
--- a/mysql-test/t/ndb_binlog_multi.test
+++ b/mysql-test/t/ndb_binlog_multi.test
@@ -34,7 +34,7 @@ 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
+--source include/show_binlog_events2.inc
select * from t2 order by a;
--replace_column 1 <the_epoch>
SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM
@@ -47,7 +47,7 @@ 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
+--source include/show_binlog_events2.inc
--replace_result $the_epoch <the_epoch>
eval SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch=$the_epoch;
@@ -62,7 +62,7 @@ reset master;
connection server2;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB;
INSERT INTO t1 VALUES (1),(2);
---source include/show_binlog_events.inc
+--source include/show_binlog_events2.inc
--replace_column 1 <the_epoch2>
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
@@ -77,7 +77,7 @@ 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
+--source include/show_binlog_events2.inc
--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
eval SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2;
diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test
index fb0536f0d10..b9a8c7e20ee 100644
--- a/mysql-test/t/ndb_blob.test
+++ b/mysql-test/t/ndb_blob.test
@@ -97,6 +97,11 @@ update t1 set d=null where a=1;
commit;
select a from t1 where d is null;
+# bug#24028 - does not occur on MySQL level
+# bug#17986 - not seen by us anymore but could show as warning here
+delete from t1 where a=45567;
+commit;
+
# pk delete
delete from t1 where a=1;
delete from t1 where a=2;
diff --git a/mysql-test/t/ndb_cache_multi2.test b/mysql-test/t/ndb_cache_multi2.test
index 4abb537624a..2afcf0c18f7 100644
--- a/mysql-test/t/ndb_cache_multi2.test
+++ b/mysql-test/t/ndb_cache_multi2.test
@@ -36,7 +36,11 @@ insert into t1 value (2);
insert into t2 value (3);
select * from t1;
# Run the check query once to load it into qc on server1
+# See at the end of this test why we need to disable ps-protocol for
+# this query (*)
+--disable_ps_protocol
select a != 3 from t1;
+--enable_ps_protocol
select * from t2;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
@@ -93,3 +97,30 @@ set GLOBAL query_cache_size=0;
set GLOBAL ndb_cache_check_time=0;
reset query cache;
flush status;
+
+# (*) Why we need to execute the query in non-ps mode.
+# The principle of this test is: two mysqlds connected to one cluster,
+# both using their query cache. Queries are cached in server1
+# ("select a!=3 from t1", "select * from t1"),
+# table t1 is modified in server2, we want to see that this invalidates
+# the query cache of server1. Invalidation with NDB works like this:
+# when a query is found in the query cache, NDB is asked if the tables
+# have changed. In this test, ha_ndbcluster calls NDB every millisecond
+# to collect change information about tables.
+# Due to this millisecond delay, there is need for a loop ("while...")
+# in this test, which waits until a query1 ("select a!=3 from t1") is
+# invalidated (which is equivalent to it returning
+# up-to-date results), and then expects query2 ("select * from t1")
+# to have been invalidated (see up-to-date results).
+# But when enabling --ps-protocol in this test, the logic breaks,
+# because query1 is still done via mysql_real_query() (see mysqltest.c:
+# eval_expr() always uses mysql_real_query()). So, query1 returning
+# up-to-date results is not a sign of it being invalidated in the cache,
+# because it was NOT in the cache ("select a!=3 from t1" on line 39
+# was done with prep stmts, while `select a!=3 from t1` is not,
+# thus the second does not see the first in the cache). Thus, we may run
+# query2 when cache still has not been invalidated.
+# The solution is to make the initial "select a!=3 from t1" run
+# as a normal query, this repairs the broken logic.
+# But note, "select * from t1" is still using prepared statements
+# which was the goal of this test with --ps-protocol.
diff --git a/mysql-test/t/ndb_dd_basic.test b/mysql-test/t/ndb_dd_basic.test
index 5d43d7997b0..3acf4669868 100644
--- a/mysql-test/t/ndb_dd_basic.test
+++ b/mysql-test/t/ndb_dd_basic.test
@@ -7,6 +7,10 @@
# Change Date: 2006-01-11
# Change: Cleanup and test rename
#################################
+# Change Author: Guangbao Ni
+# Change Date: 2007-03-20
+# Change: Test insert data when no datafile in spacetable
+#################################
-- source include/have_ndb.inc
@@ -216,6 +220,42 @@ ENGINE = NDB;
DROP TABLE t1;
+create tablespace ts2
+add datafile 'datafile2_1.dat'
+use logfile group lg1
+initial_size 12M
+engine ndb;
+
+CREATE TABLE City (
+ ID int(11) NOT NULL AUTO_INCREMENT,
+ Name char(35) NOT NULL,
+ CountryCode char(3) NOT NULL,
+ District char(20) NOT NULL,
+ Population int(11) NOT NULL,
+ PRIMARY KEY (ID)
+) ENGINE=ndbcluster
+tablespace ts2
+storage disk;
+
+alter tablespace ts2
+drop datafile 'datafile2_1.dat'
+engine ndb;
+
+#It will give error messages: NoDatafile in tablespace
+--error ER_GET_ERRMSG
+insert
+into City (Name,CountryCode,District,Population)
+values ('BeiJing','CN','Beijing',2000);
+
+--error ER_DROP_FILEGROUP_FAILED
+drop tablespace ts2
+engine ndb;
+
+drop table City;
+
+drop tablespace ts2
+engine ndb;
+
############################
# Test update of mm/dd part
############################
@@ -367,8 +407,16 @@ insert into t1 values(7,'x');
insert into t1 values(8,'x');
delete from t1 where a = 0;
commit;
+
+delete from t1;
+begin;
+insert into t1 values (1, 'x');
+select * from t1;
+rollback;
+
set autocommit = 1;
+
drop table t1;
#############################
# Customer posted order by test case
diff --git a/mysql-test/t/ndb_loaddatalocal.test b/mysql-test/t/ndb_loaddatalocal.test
index 47054ecfbf5..3eae3891f43 100644
--- a/mysql-test/t/ndb_loaddatalocal.test
+++ b/mysql-test/t/ndb_loaddatalocal.test
@@ -25,7 +25,7 @@ create table t1(a int) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
select count(*) from t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile ;
+--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
drop table t1;
create table t1(a int) engine=myisam;
@@ -37,7 +37,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
+--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
@@ -50,7 +50,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
+--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
@@ -63,7 +63,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
+--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
diff --git a/mysql-test/t/ndb_partition_error2-master.opt b/mysql-test/t/ndb_partition_error2-master.opt
new file mode 100644
index 00000000000..955f7692c8b
--- /dev/null
+++ b/mysql-test/t/ndb_partition_error2-master.opt
@@ -0,0 +1 @@
+--ndbcluster
diff --git a/mysql-test/t/ndb_partition_error2.test b/mysql-test/t/ndb_partition_error2.test
new file mode 100644
index 00000000000..afedd0e3c5c
--- /dev/null
+++ b/mysql-test/t/ndb_partition_error2.test
@@ -0,0 +1,14 @@
+disable_query_log;
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster';
+enable_query_log;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+#
+# Bug #27359 Partitions: memory allocation error message
+#
+--error ER_PARTITION_NOT_DEFINED_ERROR
+create table t1 (s1 int) engine=ndbcluster;
+
diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test
index 9030dfbe304..662eb43c422 100644
--- a/mysql-test/t/ndb_restore.test
+++ b/mysql-test/t/ndb_restore.test
@@ -8,14 +8,21 @@ 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
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check mediumint
CREATE TABLE `t1_c` (
- `capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
+ `capgoaledatta` mediumint(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');
-
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(400,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3000,'20','threetrees.qt');
+#
+# Bug #27758 Restoring NDB backups makes table usable in SQL nodes
+# - space in key made table unusable after restore
+#
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check smallint
CREATE TABLE `t2_c` (
`capgotod` smallint(5) unsigned NOT NULL auto_increment,
`gotod` smallint(5) unsigned NOT NULL default '0',
@@ -24,9 +31,9 @@ CREATE TABLE `t2_c` (
`descrpooppo` varchar(64) default NULL,
`svcutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capgotod`),
- KEY `i_quadaddsvr` (`gotod`)
+ 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');
+INSERT INTO `t2_c` VALUES (500,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',
@@ -35,6 +42,8 @@ CREATE TABLE `t3_c` (
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check bigint
CREATE TABLE `t4_c` (
`capfa` bigint(20) unsigned NOT NULL auto_increment,
`realm` varchar(32) NOT NULL default '',
@@ -46,7 +55,7 @@ CREATE TABLE `t4_c` (
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);
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(2200,'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),(32000,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(290000000,'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',
@@ -64,9 +73,11 @@ CREATE TABLE `t6_c` (
) 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);
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check tinyint
CREATE TABLE `t7_c` (
`dardpo` char(15) NOT NULL default '',
- `dardtestard` tinyint(3) unsigned NOT NULL default '0',
+ `dardtestard` tinyint(3) unsigned NOT NULL auto_increment,
`FastFA` char(5) NOT NULL default '',
`FastCode` char(6) NOT NULL default '',
`Fastca` char(1) NOT NULL default '',
@@ -138,6 +149,9 @@ INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','
# seen by select below
CREATE TABLE t10_c (a INT AUTO_INCREMENT KEY) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO t10_c VALUES (1),(2),(3);
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check int
+insert into t10_c values (10000),(2000),(3000);
create table t1 engine=myisam as select * from t1_c;
create table t2 engine=myisam as select * from t2_c;
@@ -215,6 +229,18 @@ select count(*)
# Bug #20820 cont'd
select * from t10_c order by a;
+# Bug #27775 cont'd
+# - auto inc info should be correct
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't1_c';
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't2_c';
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't4_c';
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't7_c';
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't10_c';
#
# Try Partitioned tables as well
diff --git a/mysql-test/t/ndb_restore_print.test b/mysql-test/t/ndb_restore_print.test
new file mode 100644
index 00000000000..6dbbfdf5933
--- /dev/null
+++ b/mysql-test/t/ndb_restore_print.test
@@ -0,0 +1,189 @@
+-- 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,t10;
+--enable_warnings
+
+# basic datatypes
+create table t1
+ (pk int key
+ ,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
+ ,b1 TINYINT, b2 TINYINT UNSIGNED
+ ,c1 SMALLINT, c2 SMALLINT UNSIGNED
+ ,d1 INT, d2 INT UNSIGNED
+ ,e1 BIGINT, e2 BIGINT UNSIGNED
+ ,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+ ,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+ ,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
+ ,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+ ) engine myisam;
+
+# max values
+insert into t1 values
+ (1
+ ,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
+ ,127, 255
+ ,32767, 65535
+ ,2147483647, 4294967295
+ ,9223372036854775807, 18446744073709551615
+ ,'1','12345678901234567890123456789012','123456789'
+ ,'1','12345678901234567890123456789012','123456789'
+ ,0x12,0x123456789abcdef0, 0x012345
+ ,0x12,0x123456789abcdef0, 0x00123450
+ );
+
+# min values
+insert into t1 values
+ (2
+ ,0, 0, 0, 0, 0
+ ,-128, 0
+ ,-32768, 0
+ ,-2147483648, 0
+ ,-9223372036854775808, 0
+ ,'','',''
+ ,'','',''
+ ,0x0,0x0,0x0
+ ,0x0,0x0,0x0
+ );
+
+# null values
+insert into t1 values
+ (3
+ ,NULL,NULL,NULL,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL,NULL
+ ,NULL,NULL,NULL
+ ,NULL,NULL,NULL
+ ,NULL,NULL,NULL
+ );
+
+--vertical_results
+select pk
+ ,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
+ ,b1, b2
+ ,c1 , c2
+ ,d1 , d2
+ ,e1 , e2
+ ,f1 , f2, f3
+ ,g1 , g2, g3
+ ,hex(h1), hex(h2), hex(h3)
+ ,hex(i1), hex(i2), hex(i3)
+ from t1 order by pk;
+
+alter table t1 engine ndb;
+
+select pk
+ ,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
+ ,b1, b2
+ ,c1 , c2
+ ,d1 , d2
+ ,e1 , e2
+ ,f1 , f2, f3
+ ,g1 , g2, g3
+ ,hex(h1), hex(h2), hex(h3)
+ ,hex(i1), hex(i2), hex(i3)
+ from t1 order by pk;
+--horizontal_results
+
+--source include/ndb_backup.inc
+
+--let ndb_restore_filter=test t1
+--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by=";"
+--source include/ndb_backup_print.inc
+
+--let ndb_restore_filter=test t1
+--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by="," --fields-optionally-enclosed-by="'"
+--source include/ndb_backup_print.inc
+
+
+drop table t1;
+
+# some binary char tests with trailing spaces
+create table t1
+ (pk int key
+ ,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+ ,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+ ,h1 BINARY(1), h2 BINARY(9), h3 BINARY(255)
+ ,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+ ) engine ndb;
+
+insert into t1 values
+ (1
+ ,'1','12345678901234567890123456789012','123456789 '
+ ,'1 ','12345678901234567890123456789012 ','123456789 '
+ ,0x20,0x123456789abcdef020, 0x012345000020
+ ,0x1200000020,0x123456789abcdef000000020, 0x00123450000020
+ );
+
+create table t2 (pk int key, a int) engine ndb;
+create table t3 (pk int key, a int) engine ndb;
+create table t4 (pk int key, a int) engine ndb;
+
+insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
+insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
+insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
+
+--source include/ndb_backup.inc
+--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-enclosed-by="'" --fields-optionally-enclosed-by="X"
+--let ndb_restore_filter=test t1
+--source include/ndb_backup_print.inc
+
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
+
+--let ndb_restore_opts=--verbose=0 --print_data --hex --tab $MYSQLTEST_VARDIR/tmp --append
+--let ndb_restore_filter=test
+--source include/ndb_backup_print.inc
+
+--let $message= t1
+--source include/show_msg.inc
+--exec sort $MYSQLTEST_VARDIR/tmp/t1.txt
+--let $message= t2
+--source include/show_msg.inc
+--exec sort $MYSQLTEST_VARDIR/tmp/t2.txt
+--let $message= t3
+--source include/show_msg.inc
+--exec sort $MYSQLTEST_VARDIR/tmp/t3.txt
+--let $message= t4
+--source include/show_msg.inc
+--exec sort $MYSQLTEST_VARDIR/tmp/t4.txt
+
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
+
+# now test some other datatypes
+drop table t1;
+create table t1
+ (pk int key
+ ,a1 MEDIUMINT, a2 MEDIUMINT UNSIGNED
+ ) engine ndb;
+
+# max values
+insert into t1 values(1, 8388607, 16777215);
+# min values
+insert into t1 values(2, -8388608, 0);
+# small values
+insert into t1 values(3, -1, 1);
+
+# backup and print
+--source include/ndb_backup.inc
+
+--let ndb_restore_filter=test t1
+--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by=";"
+--source include/ndb_backup_print.inc
+
+# clean up
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
diff --git a/mysql-test/t/ndb_single_user.test b/mysql-test/t/ndb_single_user.test
new file mode 100644
index 00000000000..f2f47becb0c
--- /dev/null
+++ b/mysql-test/t/ndb_single_user.test
@@ -0,0 +1,117 @@
+-- source include/have_ndb.inc
+-- source include/have_multi_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,t10;
+--enable_warnings
+
+# operations allowed while cluster is in single user mode
+
+--connection server1
+--let $node_id= `SHOW STATUS LIKE 'Ndb_cluster_node_id'`
+--disable_query_log
+--eval set @node_id= SUBSTRING('$node_id', 20)+0
+--enable_query_log
+--let $node_id= `SELECT @node_id`
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT
+
+# verify that we are indeed in single user mode
+--connection server2
+--error 1005
+create table t1 (a int key, b int unique, c int) engine ndb;
+
+# test some sql on first mysqld
+--connection server1
+create table t1 (a int key, b int unique, c int) engine ndb;
+insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
+create table t2 as select * from t1;
+# read with pk
+select * from t1 where a = 1;
+# read with unique index
+select * from t1 where b = 4;
+# read with ordered index
+select * from t1 where a > 4 order by a;
+# update with pk
+update t1 set b=102 where a = 2;
+# update with unique index
+update t1 set b=103 where b = 3;
+# update with full table scan
+update t1 set b=b+100;
+# update with ordered insex scan
+update t1 set b=b+100 where a > 7;
+# delete with full table scan
+delete from t1;
+insert into t1 select * from t2;
+
+# test some sql on other mysqld
+--connection server2
+--error 1051
+drop table t1;
+--error 1296
+create index new_index on t1 (c);
+--error 1296
+insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
+--error 1296
+select * from t1 where a = 1;
+--error 1296
+select * from t1 where b = 4;
+--error 1296
+update t1 set b=102 where a = 2;
+--error 1296
+update t1 set b=103 where b = 3;
+--error 1296
+update t1 set b=b+100;
+--error 1296
+update t1 set b=b+100 where a > 7;
+
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+
+#
+# we should be able to run transaction while in single user mode
+#
+--connection server1
+BEGIN;
+update t1 set b=b+100 where a=1;
+
+--connection server2
+BEGIN;
+update t1 set b=b+100 where a=2;
+
+# enter single user mode
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT
+
+--connection server1
+update t1 set b=b+100 where a=3;
+COMMIT;
+
+# while on other mysqld it should be aborted
+--connection server2
+--error 1296
+update t1 set b=b+100 where a=4;
+--error 1296
+COMMIT;
+
+# Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb
+# tables for other mysqld nodes
+--connection server2
+create table t2 (a int) engine myisam;
+alter table t2 add column (b int);
+
+# exit single user mode
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+
+# cleanup
+--connection server2
+drop table t2;
+--connection server1
+drop table t1;
+
+# End of 5.0 tests
+
diff --git a/mysql-test/t/ndb_trigger.test b/mysql-test/t/ndb_trigger.test
index 7a4e58033a9..586fdc0ac97 100644
--- a/mysql-test/t/ndb_trigger.test
+++ b/mysql-test/t/ndb_trigger.test
@@ -110,5 +110,112 @@ drop trigger t4_au;
drop trigger t4_ad;
drop table t1, t2, t3, t4, t5;
+# Test for bug#26242
+# Verify that AFTER UPDATE/DELETE triggers are executed
+# after the change has actually taken place
+
+CREATE TABLE t1 (
+ id INT NOT NULL PRIMARY KEY,
+ xy INT
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (1, 0);
+
+DELIMITER //;
+CREATE TRIGGER t1_update AFTER UPDATE ON t1 FOR EACH ROW BEGIN REPLACE INTO t2 SELECT * FROM t1 WHERE t1.id = NEW.id; END //
+DELIMITER ;//
+
+CREATE TABLE t2 (
+ id INT NOT NULL PRIMARY KEY,
+ xy INT
+) ENGINE=ndbcluster;
+
+INSERT INTO t2 VALUES (2, 0);
+
+CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY) ENGINE=ndbcluster;
+
+INSERT INTO t3 VALUES (1);
+
+CREATE TABLE t4 LIKE t1;
+
+DELIMITER //;
+CREATE TRIGGER t4_update AFTER UPDATE ON t4 FOR EACH ROW BEGIN REPLACE INTO t5 SELECT * FROM t4 WHERE t4.id = NEW.id; END //
+DELIMITER ;//
+
+CREATE TABLE t5 LIKE t2;
+
+UPDATE t1 SET xy = 3 WHERE id = 1;
+SELECT xy FROM t1 where id = 1;
+SELECT xy FROM t2 where id = 1;
+
+UPDATE t1 SET xy = 4 WHERE id IN (SELECT id FROM t3 WHERE id = 1);
+SELECT xy FROM t1 where id = 1;
+SELECT xy FROM t2 where id = 1;
+
+INSERT INTO t4 SELECT * FROM t1;
+INSERT INTO t5 SELECT * FROM t2;
+UPDATE t1,t4 SET t1.xy = 3, t4.xy = 3 WHERE t1.id = 1 AND t4.id = 1;
+SELECT xy FROM t1 where id = 1;
+SELECT xy FROM t2 where id = 1;
+SELECT xy FROM t4 where id = 1;
+SELECT xy FROM t5 where id = 1;
+
+UPDATE t1,t4 SET t1.xy = 4, t4.xy = 4 WHERE t1.id IN (SELECT id FROM t3 WHERE id = 1) AND t4.id IN (SELECT id FROM t3 WHERE id = 1);
+SELECT xy FROM t1 where id = 1;
+SELECT xy FROM t2 where id = 1;
+SELECT xy FROM t4 where id = 1;
+SELECT xy FROM t5 where id = 1;
+
+INSERT INTO t1 VALUES (1,0) ON DUPLICATE KEY UPDATE xy = 5;
+SELECT xy FROM t1 where id = 1;
+SELECT xy FROM t2 where id = 1;
+
+DROP TRIGGER t1_update;
+DROP TRIGGER t4_update;
+
+DELIMITER //;
+CREATE TRIGGER t1_delete AFTER DELETE ON t1 FOR EACH ROW BEGIN REPLACE INTO t2 SELECT * FROM t1 WHERE t1.id > 4; END //
+DELIMITER ;//
+
+DELIMITER //;
+CREATE TRIGGER t4_delete AFTER DELETE ON t4 FOR EACH ROW BEGIN REPLACE INTO t5 SELECT * FROM t4 WHERE t4.id > 4; END //
+DELIMITER ;//
+
+INSERT INTO t1 VALUES (5, 0),(6,0);
+INSERT INTO t2 VALUES (5, 1),(6,1);
+INSERT INTO t3 VALUES (5);
+SELECT * FROM t1 order by id;
+SELECT * FROM t2 order by id;
+DELETE FROM t1 WHERE id IN (SELECT id FROM t3 WHERE id = 5);
+SELECT * FROM t1 order by id;
+SELECT * FROM t2 order by id;
+
+INSERT INTO t1 VALUES (5,0);
+UPDATE t2 SET xy = 1 WHERE id = 6;
+TRUNCATE t4;
+INSERT INTO t4 SELECT * FROM t1;
+TRUNCATE t5;
+INSERT INTO t5 SELECT * FROM t2;
+SELECT * FROM t1 order by id;
+SELECT * FROM t2 order by id;
+SELECT * FROM t4 order by id;
+SELECT * FROM t5 order by id;
+DELETE FROM t1,t4 USING t1,t3,t4 WHERE t1.id IN (SELECT id FROM t3 WHERE id = 5) AND t4.id IN (SELECT id FROM t3 WHERE id = 5);
+SELECT * FROM t1 order by id;
+SELECT * FROM t2 order by id;
+SELECT * FROM t4 order by id;
+SELECT * FROM t5 order by id;
+
+INSERT INTO t1 VALUES (5, 0);
+REPLACE INTO t2 VALUES (6,1);
+SELECT * FROM t1 order by id;
+SELECT * FROM t2 order by id;
+REPLACE INTO t1 VALUES (5, 1);
+SELECT * FROM t1 order by id;
+SELECT * FROM t2 order by id;
+
+DROP TRIGGER t1_delete;
+DROP TRIGGER t4_delete;
+DROP TABLE t1, t2, t3, t4, t5;
--echo End of 5.1 tests
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index 8772b8157e3..fd562089483 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -96,4 +96,49 @@ drop table t1;
--error 1
--exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+#
+# Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23
+#
+# Test that we can open encrypted connection to server without
+# verification of servers certificate by setting both ca certificate
+# and ca path to NULL
+#
+--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
+--echo End of 5.0 tests
+
+#
+# Bug #26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS in
+# Event (see also information_schema.test for the other part of test for
+# this bug).
+#
+--disable_warnings
+DROP TABLE IF EXISTS thread_status;
+DROP EVENT IF EXISTS event_status;
+--enable_warnings
+
+SET GLOBAL event_scheduler=1;
+
+DELIMITER $$;
+
+CREATE EVENT event_status
+ ON SCHEDULE AT NOW()
+ ON COMPLETION NOT PRESERVE
+ DO
+BEGIN
+ CREATE TABLE thread_status
+ SELECT variable_name, variable_value
+ FROM information_schema.session_status
+ WHERE variable_name LIKE 'SSL_ACCEPTS' OR
+ variable_name LIKE 'SSL_CALLBACK_CACHE_HITS';
+END$$
+
+DELIMITER ;$$
+
+let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_status';
+--source include/wait_condition.inc
+
+SELECT variable_name, variable_value FROM thread_status;
+DROP TABLE thread_status;
+SET GLOBAL event_scheduler=0;
+--echo End of 5.1 tests
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index c9ae0964e17..c2669856bf4 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -617,7 +617,6 @@ UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol;
DROP TABLE bug25126;
-
#
# Bug #25427: crash when order by expression contains a name
# that cannot be resolved unambiguously
@@ -633,6 +632,41 @@ SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
DROP TABLE t1;
+#
+# Bug #27532: ORDER/GROUP BY expressions with IN/BETWEEN and NOT IN/BETWEEN
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (3), (2), (4), (1);
+
+SELECT a, IF(a IN (2,3), a, a+10) FROM t1
+ ORDER BY IF(a IN (2,3), a, a+10);
+SELECT a, IF(a NOT IN (2,3), a, a+10) FROM t1
+ ORDER BY IF(a NOT IN (2,3), a, a+10);
+SELECT a, IF(a IN (2,3), a, a+10) FROM t1
+ ORDER BY IF(a NOT IN (2,3), a, a+10);
+
+SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
+ ORDER BY IF(a BETWEEN 2 AND 3, a, a+10);
+SELECT a, IF(a NOT BETWEEN 2 AND 3, a, a+10) FROM t1
+ ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
+SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
+ ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
+
+SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
+ FROM t1 GROUP BY x1, x2;
+SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
+ FROM t1 GROUP BY x1, IF(a NOT IN (1,2), a, '');
+
+# The remaining queries are for better coverage
+SELECT a, a IN (1,2) FROM t1 ORDER BY a IN (1,2);
+SELECT a FROM t1 ORDER BY a IN (1,2);
+SELECT a+10 FROM t1 ORDER BY a IN (1,2);
+SELECT a, IF(a IN (1,2), a, a+10) FROM t1
+ ORDER BY IF(a IN (3,4), a, a+10);
+DROP TABLE t1;
+
+# End of 4.1
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
@@ -679,6 +713,21 @@ select a,(sum(b)/sum(c)) as ratio from t1 group by a order by sum(b)/sum(c) asc;
drop table t1;
#
+# Bug#26672: Incorrect SEC_TO_TIME() casting in ORDER BY
+#
+CREATE TABLE t1 (a INT UNSIGNED NOT NULL, b TIME);
+INSERT INTO t1 (a) VALUES (100000), (0), (100), (1000000),(10000), (1000), (10);
+UPDATE t1 SET b = SEC_TO_TIME(a);
+
+-- Correct ORDER
+SELECT a, b FROM t1 ORDER BY b DESC;
+
+-- must be ordered as the above
+SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC;
+
+DROP TABLE t1;
+
+#
# BUG#16590: Optimized does not do right "const" table pre-read
#
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE KEY b (b));
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 7d7ef95626a..399f3c4a41d 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -1463,4 +1463,33 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
drop table t1, t2;
+#
+# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
+#
+
+disable_query_log;
+eval create table t2 (i int )
+partition by range (i)
+(
+ partition p01 values less than (1000)
+ data directory="$MYSQLTEST_VARDIR/master-data/test/"
+ index directory="$MYSQLTEST_VARDIR/master-data/test/"
+);
+enable_query_log;
+
+set @org_mode=@@sql_mode;
+set @@sql_mode='NO_DIR_IN_CREATE';
+select @@sql_mode;
+create table t1 (i int )
+partition by range (i)
+(
+ partition p01 values less than (1000)
+ data directory='/not/existing'
+ index directory='/not/existing'
+);
+
+show create table t2;
+DROP TABLE t1, t2;
+set @@sql_mode=@org_mode;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/partition_grant.test b/mysql-test/t/partition_grant.test
index ee7c71b497a..0d30ad01c7a 100644
--- a/mysql-test/t/partition_grant.test
+++ b/mysql-test/t/partition_grant.test
@@ -52,8 +52,30 @@ disconnect conn3;
connection default;
revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
drop table t1;
+
+#
+# Bug #23675 Partitions: possible security breach via alter
+#
+
+create table t1 (s1 int);
+insert into t1 values (1);
+grant alter on mysqltest_1.* to mysqltest_1@localhost;
+connect (conn4,localhost,mysqltest_1,,mysqltest_1);
+connection conn4;
+--error 1514
+alter table t1 partition by list (s1) (partition p1 values in (2));
+connection default;
+grant select, alter on mysqltest_1.* to mysqltest_1@localhost;
+disconnect conn4;
+connect (conn5,localhost,mysqltest_1,,mysqltest_1);
+--error 1514
+alter table t1 partition by list (s1) (partition p1 values in (2));
+disconnect conn5;
+connection default;
+drop table t1;
+
+drop user mysqltest_1@localhost;
drop schema mysqltest_1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 14ee30f6026..44f9bf350b2 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -2324,7 +2324,7 @@ drop event if exists xyz;
#drop event xyz;
#drop procedure proc_1;
delimiter |;
---error ER_EVENT_RECURSIVITY_FORBIDDEN
+--error ER_EVENT_RECURSION_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
@@ -2516,3 +2516,60 @@ set @to_format="10000";
execute stmt2 using @to_format, @dec;
deallocate prepare stmt2;
+
+#
+# BUG#18326: Do not lock table for writing during prepare of statement
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (i INT);
+INSERT INTO t2 VALUES (2);
+
+LOCK TABLE t1 READ, t2 WRITE;
+
+connect (conn1, localhost, root, , );
+
+# Prepare never acquires the lock, and thus should not block.
+PREPARE stmt1 FROM "SELECT i FROM t1";
+PREPARE stmt2 FROM "INSERT INTO t2 (i) VALUES (3)";
+
+# This should not block because READ lock on t1 is shared.
+EXECUTE stmt1;
+
+# This should block because WRITE lock on t2 is exclusive.
+send EXECUTE stmt2;
+
+connection default;
+
+SELECT * FROM t2;
+UNLOCK TABLES;
+let $wait_condition= SELECT COUNT(*) = 2 FROM t2;
+--source include/wait_condition.inc
+SELECT * FROM t2;
+
+# DDL and DML works even if some client have a prepared statement
+# referencing the table.
+ALTER TABLE t1 ADD COLUMN j INT;
+ALTER TABLE t2 ADD COLUMN j INT;
+INSERT INTO t1 VALUES (4, 5);
+INSERT INTO t2 VALUES (4, 5);
+
+connection conn1;
+
+reap;
+EXECUTE stmt1;
+EXECUTE stmt2;
+SELECT * FROM t2;
+
+disconnect conn1;
+
+connection default;
+
+DROP TABLE t1, t2;
+
+
+--echo End of 5.1 tests.
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 87e2ef511d9..8920b424021 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -907,4 +907,24 @@ start transaction;
insert into t1(c1) select c1 from v1;
drop table t1, t2, t3;
drop view v1;
+
+
+#
+# If running with --ps-protocol:
+# see if a query from the text protocol is served with results cached
+# from a query which used the binary (which would be wrong, results
+# are in different formats); if that happens, the results will
+# be incorrect and the test will fail.
+#
+
+create table t1(c1 int);
+insert into t1 values(1),(10),(100);
+select * from t1;
+-- disable_ps_protocol
+select * from t1;
+select * from t1;
+-- enable_ps_protocol
+select * from t1;
+drop table t1;
+
set global query_cache_size=0;
diff --git a/mysql-test/t/query_cache_sql_prepare.test b/mysql-test/t/query_cache_sql_prepare.test
new file mode 100644
index 00000000000..a02388b2ae5
--- /dev/null
+++ b/mysql-test/t/query_cache_sql_prepare.test
@@ -0,0 +1,146 @@
+# This is to see how statements prepared via the PREPARE SQL command
+# go into the query cache: if using parameters they cannot; if not
+# using parameters they can.
+# Query cache is abbreviated as "QC"
+
+-- source include/have_query_cache.inc
+# embedded can't make more than one connection, which this test needs
+-- source include/not_embedded.inc
+
+connect (con1,localhost,root,,test,$MASTER_MYPORT,);
+connection default;
+
+set global query_cache_size=100000;
+flush status;
+create table t1(c1 int);
+insert into t1 values(1),(10),(100);
+
+# Prepared statements has no parameters, query caching should happen
+prepare stmt1 from "select * from t1 where c1=10";
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+# Another prepared statement (same text, same connection), should hit the QC
+prepare stmt2 from "select * from t1 where c1=10";
+execute stmt2;
+show status like 'Qcache_hits';
+execute stmt2;
+show status like 'Qcache_hits';
+execute stmt2;
+show status like 'Qcache_hits';
+# Another prepared statement (same text, other connection), should hit the QC
+connection con1;
+prepare stmt3 from "select * from t1 where c1=10";
+execute stmt3;
+show status like 'Qcache_hits';
+execute stmt3;
+show status like 'Qcache_hits';
+execute stmt3;
+show status like 'Qcache_hits';
+connection default;
+# A non-prepared statement (same text, same connection), should hit
+# the QC (as it uses the text protocol like SQL EXECUTE).
+# But if it uses the binary protocol, it will not hit. So we make sure
+# that it uses the text protocol:
+-- disable_ps_protocol
+select * from t1 where c1=10;
+show status like 'Qcache_hits';
+ # A non-prepared statement (same text, other connection), should hit
+# the QC. To test that it hits the result of SQL EXECUTE, we need to
+# empty/repopulate the QC (to remove the result from the non-prepared
+# SELECT just above).
+flush tables;
+execute stmt1;
+show status like 'Qcache_hits';
+connection con1;
+select * from t1 where c1=10;
+show status like 'Qcache_hits';
+-- enable_ps_protocol
+connection default;
+
+# Prepared statement has parameters, query caching should not happen
+prepare stmt1 from "select * from t1 where c1=?";
+show status like 'Qcache_hits';
+set @a=1;
+execute stmt1 using @a;
+show status like 'Qcache_hits';
+set @a=100;
+execute stmt1 using @a;
+show status like 'Qcache_hits';
+set @a=10;
+execute stmt1 using @a;
+show status like 'Qcache_hits';
+
+# See if enabling/disabling the query cache between PREPARE and
+# EXECUTE is an issue; the expected result is that the query cache
+# will not be used.
+# Indeed, decision to read/write the query cache is taken at PREPARE
+# time, so if the query cache was disabled at PREPARE time then no
+# execution of the statement will read/write the query cache.
+# If the query cache was enabled at PREPARE time, but disabled at
+# EXECUTE time, at EXECUTE time the query cache internal functions do
+# nothing so again the query cache is not read/written. But if the
+# query cache is re-enabled before another execution then that
+# execution will read/write the query cache.
+
+# QC is enabled at PREPARE
+prepare stmt1 from "select * from t1 where c1=10";
+# then QC is disabled at EXECUTE
+set global query_cache_size=0;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+# then QC is re-enabled for more EXECUTE.
+set global query_cache_size=100000;
+# Note that this execution will not hit results from the
+# beginning of the test (because QC has been emptied meanwhile by
+# setting its size to 0).
+execute stmt1;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+
+# QC is disabled at PREPARE
+set global query_cache_size=0;
+prepare stmt1 from "select * from t1 where c1=10";
+# then QC is enabled at EXECUTE
+set global query_cache_size=100000;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+execute stmt1;
+show status like 'Qcache_hits';
+
+# QC is disabled at PREPARE
+set global query_cache_size=0;
+prepare stmt1 from "select * from t1 where c1=?";
+# then QC is enabled at EXECUTE
+set global query_cache_size=100000;
+show status like 'Qcache_hits';
+set @a=1;
+execute stmt1 using @a;
+show status like 'Qcache_hits';
+set @a=100;
+execute stmt1 using @a;
+show status like 'Qcache_hits';
+set @a=10;
+execute stmt1 using @a;
+show status like 'Qcache_hits';
+
+
+drop table t1;
+
+set global query_cache_size=0;
+flush status; # reset Qcache status variables for next tests
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index b1cec049ab2..06c2ef248c4 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -568,6 +568,149 @@ SELECT s.oxid FROM t1 v, t1 s
DROP TABLE t1;
+# BUG#26624 high mem usage (crash) in range optimizer (depends on order of fields in where)
+create table t1 (
+ c1 char(10), c2 char(10), c3 char(10), c4 char(10),
+ c5 char(10), c6 char(10), c7 char(10), c8 char(10),
+ c9 char(10), c10 char(10), c11 char(10), c12 char(10),
+ c13 char(10), c14 char(10), c15 char(10), c16 char(10),
+ index(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,c13,c14,c15,c16)
+);
+insert into t1 (c1) values ('1'),('1'),('1'),('1');
+
+# This must run without crash and fast:
+select * from t1 where
+ c1 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+ and c2 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+ and c3 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+ and c4 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+ and c5 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+ and c6 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+ and c7 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+ and c8 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+ and c9 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
+ and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
+ "abcdefg1", "123456781", "qwertyui1", "asddfg1",
+ "abcdefg2", "123456782", "qwertyui2", "asddfg2",
+ "abcdefg3", "123456783", "qwertyui3", "asddfg3",
+ "abcdefg4", "123456784", "qwertyui4", "asddfg4",
+ "abcdefg5", "123456785", "qwertyui5", "asddfg5",
+ "abcdefg6", "123456786", "qwertyui6", "asddfg6",
+ "abcdefg7", "123456787", "qwertyui7", "asddfg7",
+ "abcdefg8", "123456788", "qwertyui8", "asddfg8",
+ "abcdefg9", "123456789", "qwertyui9", "asddfg9",
+ "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
+ "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
+ "abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
+drop table t1;
--echo End of 4.1 tests
#
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index 63c611e6be6..bf25359b7be 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -85,6 +85,31 @@ drop table t1;
SELECT ROW(2,10) <=> ROW(3,4);
SELECT ROW(NULL,10) <=> ROW(3,NULL);
+#
+# Bug #27484: nested row expressions in IN predicate
+#
+
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1));
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1),ROW(1,ROW(2,3)));
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,ROW(2,2,2)));
+--error 1241
+SELECT ROW(1,ROW(2,3,4)) IN (ROW(1,ROW(2,3,4)),ROW(1,ROW(2,2)));
+
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1));
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1),ROW(1,ROW(2,4)));
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN ((SELECT 1,1),ROW(1,ROW(2,3)));
+
+--error 1241
+SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
+--error 1241
+SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
+
# End of 4.1 tests
#
@@ -139,3 +164,20 @@ EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
DROP TABLE t1,t2;
+
+#
+# Bug #27154: crash (memory corruption) when using row equalities
+#
+
+CREATE TABLE t1(
+ a int, b int, c int, d int, e int, f int, g int, h int,
+ PRIMARY KEY (a,b,c,d,e,f,g)
+);
+INSERT INTO t1 VALUES (1,2,3,4,5,6,7,99);
+
+SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7);
+
+SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7));
+SELECT @x;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/rpl_critical_errors.test b/mysql-test/t/rpl_critical_errors.test
new file mode 100644
index 00000000000..ffe00050b01
--- /dev/null
+++ b/mysql-test/t/rpl_critical_errors.test
@@ -0,0 +1,66 @@
+# Test for BUG#26551
+#
+
+# This test is unfortunately very fragile and very dependent on the
+# load of the computer. The test is therefore disabled normally. It is
+# entered here to demonstrate how to check that the bug is actually
+# solved.
+
+--echo Turn on parsing to run this test
+
+disable_parsing;
+
+source include/master-slave.inc;
+
+connection master;
+CREATE TABLE t1 (data LONGBLOB) ENGINE=MYISAM;
+CREATE TABLE t2 (data LONGBLOB) ENGINE=MYISAM;
+
+INSERT INTO t1 (data) VALUES (repeat('a',1024*1024));
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+sync_slave_with_master;
+
+connection master;
+send INSERT INTO t2 SELECT * FROM t1;
+
+connection master1;
+
+# This sleep is picked so that the query above has started to insert
+# some rows into t2. If it hasn't the slave will not stop below.
+sleep 4;
+
+# SHOW PROCESSLIST;
+
+# Code for the 5.1 server to get the thread id of the thread executing
+# the query above.
+#
+#SET @id = 0;
+#SELECT id INTO @id
+# FROM information_schema.processlist
+# WHERE info LIKE 'INSERT INTO t2%';
+
+# This is the connection that is executing the INSERT INTO t2...
+KILL QUERY 2;
+
+connection slave;
+
+# Here the slave will only stop if the query above actually started
+# inserting some rows into t2. Otherwise, it will hang forever.
+wait_for_slave_to_stop;
+
+# The following should be 0
+SELECT COUNT(*) FROM t2;
+
+# ... and there the error code should be 1317 (ER_QUERY_INTERRUPTED)
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 20 # 22 # 23 # 33 #
+query_vertical SHOW SLAVE STATUS;
+
+enable_parsing;
diff --git a/mysql-test/t/rpl_ddl.test b/mysql-test/t/rpl_ddl.test
index ca1c25c5f09..80df16a7a00 100644
--- a/mysql-test/t/rpl_ddl.test
+++ b/mysql-test/t/rpl_ddl.test
@@ -22,13 +22,11 @@
# 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/not_ndb_default.inc
---source include/have_innodb.inc
--source include/master-slave.inc
-let $engine_type= "InnoDB";
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+let $temp_engine_type= MEMORY;
+let $show_binlog = 0;
+let $manipulate = 0;
-- source extra/rpl_tests/rpl_ddl.test
diff --git a/mysql-test/t/rpl_dual_pos_advance.test b/mysql-test/t/rpl_dual_pos_advance.test
index 518fa9df885..074aeec63b1 100644
--- a/mysql-test/t/rpl_dual_pos_advance.test
+++ b/mysql-test/t/rpl_dual_pos_advance.test
@@ -106,3 +106,9 @@ connection slave;
sync_with_master;
# End of 4.1 tests
+
+# Cleanup
+# The A->B->A replication causes the master to start writing relay logs
+# in var/run, remove them
+remove_file $MYSQLTEST_VARDIR/run/master-relay-bin.000001;
+remove_file $MYSQLTEST_VARDIR/run/master-relay-bin.index;
diff --git a/mysql-test/t/rpl_events.test b/mysql-test/t/rpl_events.test
new file mode 100644
index 00000000000..895e94c438b
--- /dev/null
+++ b/mysql-test/t/rpl_events.test
@@ -0,0 +1,24 @@
+##################################################################
+# Author: Giuseppe #
+# Date: 2006-12-20 #
+# Purpose: To test that event effects are replicated #
+# in both row based and statement based format #
+##################################################################
+
+set global event_scheduler=1;
+
+--source include/not_embedded.inc
+--source include/master-slave.inc
+
+let $engine_type= MyISAM;
+
+set binlog_format=row;
+
+# Embedded server doesn't support binlogging
+--source include/rpl_events.inc
+
+set binlog_format=statement;
+
+# Embedded server doesn't support binlogging
+--source include/rpl_events.inc
+
diff --git a/mysql-test/t/rpl_flushlog_loop.test b/mysql-test/t/rpl_flushlog_loop.test
index ded111d769f..471c45a1aa3 100644
--- a/mysql-test/t/rpl_flushlog_loop.test
+++ b/mysql-test/t/rpl_flushlog_loop.test
@@ -5,6 +5,9 @@
#
# Start replication master -> slave
#
+# We have to sync with master, to ensure slave had time to start properly
+# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
+sync_slave_with_master;
connection slave;
--disable_warnings
stop slave;
diff --git a/mysql-test/t/rpl_ignore_table.test b/mysql-test/t/rpl_ignore_table.test
index 10c75db0b70..fd4ae64165a 100644
--- a/mysql-test/t/rpl_ignore_table.test
+++ b/mysql-test/t/rpl_ignore_table.test
@@ -27,8 +27,118 @@ SELECT * FROM t4;
connection master;
DROP TABLE t1;
DROP TABLE t4;
+
+sync_slave_with_master;
+
+
+#
+# Bug#25482 GRANT statements are not replicated if
+# you use "replicate-ignore-table"
+#
+
+--echo **** Test case for BUG#25482 ****
+--echo **** Adding GRANTS on master ****
+
+connection master;
+create table test.t1(a int);
+create table test.t4(a int);
+
+# Simple user that should not replicate
+GRANT SELECT ON test.t1 TO mysqltest1@localhost;
+
+# Partial replicate
+GRANT INSERT ON test.t4 TO mysqltest2@localhost;
+GRANT select, update, insert, references on t1
+ to mysqltest2@localhost;
+
+# Partial replicate 2
+GRANT SELECT ON test.* TO mysqltest3@localhost;
+GRANT INSERT ON test.t4 TO mysqltest3@localhost;
+GRANT select(a), update(a), insert(a), references(a) on t4
+ to mysqltest3@localhost;
+
+# Create another database and table
+create database mysqltest2;
+create table mysqltest2.t2 (id int);
+# Create a grant that should replicate
+GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
+
+# Create a grant manually
+insert into mysql.user (user, host) values ("mysqltest5", "somehost");
+
+# Partial replicate 3 with *.*
+GRANT SELECT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON test.* TO mysqltest6@localhost;
+GRANT INSERT ON test.t1 TO mysqltest6@localhost;
+
+show grants for mysqltest1@localhost;
+show grants for mysqltest2@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+show grants for mysqltest6@localhost;
+
+flush privileges;
+show grants for mysqltest5@somehost;
+
+
sync_slave_with_master;
+--echo **** Checking grants on slave ****
+
+# Check that grants are replicated to slave
+show grants for mysqltest2@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+show grants for mysqltest5@somehost;
+show grants for mysqltest6@localhost;
+
+# mysqltest1 should not be on slave
+--error 1141
+show grants for mysqltest1@localhost;
+
+--echo **** Revoking grants on master ****
+connection master;
+REVOKE SELECT ON test.t1 FROM mysqltest1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost;
+REVOKE select(a) on t4
+ from mysqltest3@localhost;
+
+show grants for mysqltest1@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+
+sync_slave_with_master;
+
+--echo **** Checking grants on slave ****
+
+# mysqltest1 should not be on slave
+--error 1141
+show grants for mysqltest1@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+
+# Cleanup
+connection master;
+drop table t1, t4, mysqltest2.t2;
+drop database mysqltest2;
+delete from mysql.user where user like "mysqltest%";
+delete from mysql.db where user like "mysqltest%";
+#
+# BUG 27606 causes failure to replicate this statement
+# move it to slave instead
+#delete from mysql.tables_priv where user like "mysqltest%";
+delete from mysql.columns_priv where user like "mysqltest%";
+sync_slave_with_master;
+
+#BUG27606
+delete from mysql.tables_priv where user like "mysqltest%";
+
+connection master;
+
+#BUG27606
+delete from mysql.tables_priv where user like "mysqltest%";
+
#
# bug#22877 replication character sets get out of sync
# using replicate-wild-ignore-table
diff --git a/mysql-test/t/rpl_incident-master.opt b/mysql-test/t/rpl_incident-master.opt
new file mode 100644
index 00000000000..912801debc4
--- /dev/null
+++ b/mysql-test/t/rpl_incident-master.opt
@@ -0,0 +1 @@
+--loose-debug=+d,incident_database_resync_on_replace
diff --git a/mysql-test/t/rpl_incident.test b/mysql-test/t/rpl_incident.test
new file mode 100644
index 00000000000..c52f26317ad
--- /dev/null
+++ b/mysql-test/t/rpl_incident.test
@@ -0,0 +1,43 @@
+--source include/master-slave.inc
+--source include/have_debug.inc
+
+--echo **** On Master ****
+CREATE TABLE t1 (a INT);
+
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM t1;
+
+# This will generate an incident log event and store it in the binary
+# log before the replace statement.
+REPLACE INTO t1 VALUES (4);
+--save_master_pos
+SELECT * FROM t1;
+
+connection slave;
+--wait_for_slave_to_stop
+
+# The 4 should not be inserted into the table, since the incident log
+# event should have stop the slave.
+--echo **** On Slave ****
+SELECT * FROM t1;
+
+--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=1;
+START SLAVE;
+--sync_with_master
+
+# Now, we should have inserted the row into the table and the slave
+# should be running. We should also have rotated to a new binary log.
+
+SELECT * FROM t1;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+DROP TABLE t1;
+connection master;
+DROP TABLE t1;
+
diff --git a/mysql-test/t/rpl_loaddata_s.test b/mysql-test/t/rpl_loaddata_s.test
index 2c94c8ef953..f397d741310 100644
--- a/mysql-test/t/rpl_loaddata_s.test
+++ b/mysql-test/t/rpl_loaddata_s.test
@@ -20,9 +20,7 @@ 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
+source include/show_binlog_events.inc;
# Cleanup
connection master;
diff --git a/mysql-test/t/rpl_loaddatalocal.test b/mysql-test/t/rpl_loaddatalocal.test
index 758ac94af24..b10603e7195 100644
--- a/mysql-test/t/rpl_loaddatalocal.test
+++ b/mysql-test/t/rpl_loaddatalocal.test
@@ -25,7 +25,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.sele
truncate table t1;
--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 ;
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
save_master_pos;
connection slave;
sync_with_master;
@@ -52,7 +52,7 @@ drop table t1;
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 ;
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
SELECT * FROM t1 ORDER BY a;
save_master_pos;
connection slave;
diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test
index 61c24da514e..b98d89c1dc3 100644
--- a/mysql-test/t/rpl_log_pos.test
+++ b/mysql-test/t/rpl_log_pos.test
@@ -18,12 +18,12 @@ sync_slave_with_master;
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
stop slave;
-change master to master_log_pos=74;
+change master to master_log_pos=75;
start slave;
sleep 5;
stop slave;
-change master to master_log_pos=74;
+change master to master_log_pos=75;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
@@ -33,11 +33,11 @@ sleep 5;
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
stop slave;
-change master to master_log_pos=177;
+change master to master_log_pos=178;
start slave;
sleep 2;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 11 # 23 # 33 #
show slave status;
connection master;
--replace_column 3 <Binlog_Ignore_DB>
@@ -49,7 +49,7 @@ insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
stop slave;
-change master to master_log_pos=102;
+change master to master_log_pos=106;
start slave;
sync_with_master;
select * from t1 ORDER BY n;
diff --git a/mysql-test/t/rpl_misc_functions.test b/mysql-test/t/rpl_misc_functions.test
index f00beff583a..db9b557baad 100644
--- a/mysql-test/t/rpl_misc_functions.test
+++ b/mysql-test/t/rpl_misc_functions.test
@@ -99,5 +99,5 @@ DROP TABLE IF EXISTS t1;
--sync_slave_with_master
# If all is good, when can cleanup our dump files.
---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
diff --git a/mysql-test/t/rpl_ndb_basic.test b/mysql-test/t/rpl_ndb_basic.test
index 5290dc377c2..04c855f8730 100644
--- a/mysql-test/t/rpl_ndb_basic.test
+++ b/mysql-test/t/rpl_ndb_basic.test
@@ -36,6 +36,37 @@ select * from t1 order by nid;
select * from t1 order by nid;
--connection master
+delete from t1;
+insert into t1 values(1,"AA", "AA");
+insert into t1 values(2,"BB", "BB");
+insert into t1 values(3,"CC", "CC");
+insert into t1 values(4,"DD", "DD");
+
+begin;
+# delete+insert = update
+delete from t1 where nid = 1;
+insert into t1 values (1,"A2", "A2");
+
+# update+delete = delete
+update t1 set nom="B2" where nid = 2;
+delete from t1 where nid = 2;
+
+# multi-update
+update t1 set nom = "D2" where nid = 4;
+delete from t1 where nid = 4;
+insert into t1 values (4, "D3", "D3");
+update t1 set nom = "D4" where nid = 4;
+
+# insert+delete = nothing
+insert into t1 values (5, "EE", "EE");
+delete from t1 where nid = 5;
+
+commit;
+select * from t1 order by 1;
+--sync_slave_with_master
+--connection slave
+select * from t1 order by 1;
+--connection master
DROP table t1;
#
@@ -79,6 +110,49 @@ select * from t1 order by nid;
--connection master
DROP table t1;
+#
+# Bug #27378 update becomes delete on slave
+#
+
+--connection master
+CREATE TABLE `t1` (
+ `prid` int(10) unsigned NOT NULL,
+ `id_type` enum('IMSI','SIP') NOT NULL,
+ `fkimssub` varchar(50) NOT NULL,
+ `user_id` varchar(20) DEFAULT NULL,
+ `password` varchar(20) DEFAULT NULL,
+ `ptg_nbr` varchar(20) DEFAULT NULL,
+ `old_tmsi` int(10) unsigned DEFAULT NULL,
+ `new_tmsi` int(10) unsigned DEFAULT NULL,
+ `dev_capability` int(10) unsigned DEFAULT NULL,
+ `dev_oid` bigint(20) unsigned DEFAULT NULL,
+ `lac_cell_id` bigint(20) unsigned DEFAULT NULL,
+ `ms_classmark1` int(10) unsigned DEFAULT NULL,
+ `cipher_key` int(10) unsigned DEFAULT NULL,
+ `priid_master` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`prid`),
+ UNIQUE KEY `fkimssub` (`fkimssub`,`ptg_nbr`) USING HASH
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO `t1` VALUES (183342,'IMSI','config3_sub_2Privates_3Publics_imssub_36668','user_id_73336','user_id_73336','73336',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(47617,'IMSI','config3_sub_2Privates_3Publics_imssub_9523','user_id_19046','user_id_19046','19046',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(200332,'IMSI','config3_sub_2Privates_3Publics_imssub_40066','user_id_80132','user_id_80132','80132',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(478882,'IMSI','config3_sub_2Privates_3Publics_imssub_95776','user_id_191552','user_id_191552','191552',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(490146,'IMSI','config3_sub_2Privates_3Publics_imssub_98029','user_id_196057','user_id_196057','196057',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(499301,'IMSI','config3_sub_2Privates_3Publics_imssub_99860','user_id_199719','user_id_199719','199719',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(506101,'IMSI','config3_sub_2Privates_3Publics_imssub_101220','user_id_202439','user_id_202439','202439',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(510142,'IMSI','config3_sub_2Privates_3Publics_imssub_102028','user_id_204056','user_id_204056','204056',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(515871,'IMSI','config3_sub_2Privates_3Publics_imssub_103174','user_id_206347','user_id_206347','206347',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(209842,'IMSI','config3_sub_2Privates_3Publics_imssub_41968','user_id_83936','user_id_83936','83936',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(365902,'IMSI','config3_sub_2Privates_3Publics_imssub_73180','user_id_146360','user_id_146360','146360',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(11892,'IMSI','config3_sub_2Privates_3Publics_imssub_2378','user_id_4756','user_id_4756','4756',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL);
+
+select count(*) from t1;
+
+--sync_slave_with_master
+--connection slave
+select count(*) from t1;
+
+--connection master
+update t1 set dev_oid=dev_oid+1;
+select count(*) from t1;
+
+--sync_slave_with_master
+--connection slave
+select count(*) from t1;
+
+--connection master
+DROP table t1;
+
##################################################################
#
# Check that retries are made on the slave on some temporary errors
diff --git a/mysql-test/t/rpl_ndb_circular.test b/mysql-test/t/rpl_ndb_circular.test
new file mode 100644
index 00000000000..88b5808160b
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_circular.test
@@ -0,0 +1,57 @@
+--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+# set up circular replication
+
+--connection slave
+RESET MASTER;
+--connection master
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--eval CHANGE MASTER TO master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root"
+START SLAVE;
+
+# create the table on the "slave"
+--connection slave
+CREATE TABLE t1 (a int key, b int) ENGINE=ndb;
+#CREATE TABLE t2 (a int key, b int) ENGINE=ndb;
+--save_master_pos
+--connection master
+--sync_with_master
+# now we should have a table on the master as well
+SHOW TABLES;
+
+# insert some values on the slave and master
+--connection master
+INSERT INTO t1 VALUES (1,2);
+--connection slave
+INSERT INTO t1 VALUES (2,3);
+
+# ensure data has propagated both ways
+--connection slave
+--save_master_pos
+--connection master
+--sync_with_master
+--sync_slave_with_master
+
+# connect to slave and ensure data it there.
+--connection slave
+SELECT * FROM t1 ORDER BY a;
+#SELECT * FROM t2 ORDER BY a;
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical show slave status;
+# connect to master and ensure data it there.
+--connection master
+SELECT * FROM t1 ORDER BY a;
+#SELECT * FROM t2 ORDER BY a;
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical show slave status;
+
+# stop replication on "master" as not to replicate
+# shutdown circularly, eg drop table
+--connection master
+STOP SLAVE;
+
+# cleanup
+--connection master
+DROP TABLE t1;
diff --git a/mysql-test/t/rpl_ndb_circular_simplex.test b/mysql-test/t/rpl_ndb_circular_simplex.test
new file mode 100644
index 00000000000..2ea60beaba2
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_circular_simplex.test
@@ -0,0 +1,82 @@
+--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+connection master;
+CREATE TABLE t1 (a int key, b int) ENGINE=NDB;
+sync_slave_with_master;
+SHOW TABLES;
+
+# Lose the events from the slave binary log: there is no
+# need to re-create the table on the master.
+connection slave;
+RESET MASTER;
+
+# Insert some values on the slave and master
+connection master;
+INSERT INTO t1 VALUES (1,2);
+# Switch to slave once event is applied and insert a row
+sync_slave_with_master;
+connection slave;
+INSERT INTO t1 VALUES (2,3);
+
+# ... it is now very probable that we have a mixed event in the binary
+# log. If we don't, the test should still pass, but will not test the
+# mixed event situation.
+
+# The statement is disabled since it cannot reliably show the same
+# info all the time. Use it for debug purposes.
+
+#SHOW BINLOG EVENTS;
+
+# Replicate back to the master to test this mixed event on the master
+STOP SLAVE;
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=$SLAVE_MYPORT,MASTER_USER="root";
+
+RESET MASTER;
+START SLAVE;
+
+connection slave;
+save_master_pos;
+connection master;
+sync_with_master;
+
+# The statement is disabled since it cannot reliably show the same
+# info all the time. Use it for debug purposes.
+
+#SHOW BINLOG EVENTS;
+
+# Check that there is no error in replication
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+query_vertical SHOW SLAVE STATUS;
+
+# Check that we have the data on the master
+SELECT * FROM t1 ORDER BY a;
+
+# We should now have another mixed event, likely with "slave" server
+# id last, and with the STMT_END_F flag set.
+
+# The statement is disabled since it cannot reliably show the same
+# info all the time. Use it for debug purposes.
+
+#SHOW BINLOG EVENTS;
+
+# now lets see that this data is applied correctly on the slave
+STOP SLAVE;
+save_master_pos;
+
+connection slave;
+START SLAVE;
+
+# check that we have the data on the slave
+sync_with_master;
+SELECT * FROM t1 ORDER BY a;
+
+# Check that there is no error in replication
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+query_vertical SHOW SLAVE STATUS;
diff --git a/mysql-test/t/rpl_ndb_dd_basic.test b/mysql-test/t/rpl_ndb_dd_basic.test
index 104be91e6e4..7387d39db87 100644
--- a/mysql-test/t/rpl_ndb_dd_basic.test
+++ b/mysql-test/t/rpl_ndb_dd_basic.test
@@ -67,7 +67,7 @@ select * from t1 order by pk1;
#
--connection master
--- source include/show_binlog_events.inc
+-- source include/show_binlog_events2.inc
#
# cleanup
diff --git a/mysql-test/t/rpl_ndb_ddl.test b/mysql-test/t/rpl_ndb_ddl.test
index 0c503e56c9c..66db755de15 100644
--- a/mysql-test/t/rpl_ndb_ddl.test
+++ b/mysql-test/t/rpl_ndb_ddl.test
@@ -1,4 +1,4 @@
-######################## rpl_ddl.test ########################
+#################### rpl_ndb_ddl.test ########################
# #
# DDL statements (sometimes with implicit COMMIT) executed #
# by the master and it's propagation into the slave #
@@ -22,14 +22,12 @@
# 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_ndb_ddl.test
-
+--source include/have_binlog_format_row.inc
+--source include/have_ndb.inc
+let $engine_type= NDB;
+let $temp_engine_type= MEMORY;
+let $show_binlog = 0;
+let $manipulate = 0;
+-- source extra/rpl_tests/rpl_ddl.test
diff --git a/mysql-test/t/rpl_ndb_do_table.test b/mysql-test/t/rpl_ndb_do_table.test
index 278a326aefd..700c79766e1 100644
--- a/mysql-test/t/rpl_ndb_do_table.test
+++ b/mysql-test/t/rpl_ndb_do_table.test
@@ -27,6 +27,20 @@ INSERT INTO t2 VALUES(3, repeat('ghi',3000));
SHOW TABLES;
SELECT COUNT(*) FROM t1;
+#
+# Bug #27044 replicated with unique field ndb table allows dup key inserts
+#
+connection master;
+
+--error ER_DUP_ENTRY_WITH_KEY_NAME
+INSERT INTO t1 VALUES (3, repeat('bad',1));
+
+connection slave;
+--error ER_DUP_ENTRY_WITH_KEY_NAME
+INSERT INTO t1 VALUES (3, repeat('bad too',1));
+
+# cleanup
+
connection master;
DROP TABLE IF EXISTS t1, t2;
--sync_slave_with_master
diff --git a/mysql-test/t/rpl_ndb_stm_innodb-master.opt b/mysql-test/t/rpl_ndb_stm_innodb-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_stm_innodb-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_ndb_stm_innodb.test b/mysql-test/t/rpl_ndb_stm_innodb.test
new file mode 100644
index 00000000000..b92fbbcfce6
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_stm_innodb.test
@@ -0,0 +1,62 @@
+--source include/have_ndb.inc
+--source include/have_innodb.inc
+--source include/have_binlog_format_mixed_or_statement.inc
+--source include/master-slave.inc
+
+--connection master
+create table t1 (a int key, b int) engine innodb;
+create table t2 (a int key, b int) engine innodb;
+
+--sync_slave_with_master
+--connection slave
+alter table t1 engine ndb;
+alter table t2 engine ndb;
+
+# check binlog position without begin
+--connection master
+insert into t1 values (1,2);
+
+--sync_slave_with_master
+--connection slave
+--replace_column 1 <start_pos> 2 <end_pos>
+select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status;
+--let $start_pos = `select @start_pos`
+--let $end_pos = `select @end_pos`
+
+--connection master
+# here is actually a bug, since there is no begin statement, the
+# query is autocommitted, and end_pos shows end of the insert and not
+# end of the commit
+--replace_result $start_pos <start_pos>
+--replace_column 5 #
+--eval show binlog events from $start_pos limit 1
+--replace_result $start_pos <start_pos> $end_pos <end_pos>
+--replace_column 2 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+--eval show binlog events from $start_pos limit 1,1
+
+# check binlog position with begin
+--connection master
+begin;
+insert into t1 values (2,3);
+insert into t2 values (3,4);
+commit;
+
+--sync_slave_with_master
+--connection slave
+--replace_column 1 <start_pos> 2 <end_pos>
+select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status;
+--let $start_pos = `select @start_pos`
+--let $end_pos = `select @end_pos`
+
+--connection master
+--replace_result $start_pos <start_pos>
+--replace_column 5 #
+--eval show binlog events from $start_pos limit 1
+--replace_result $start_pos <start_pos>
+--replace_column 2 # 4 # 5 #
+--eval show binlog events from $start_pos limit 1,2
+--replace_result $start_pos <start_pos> $end_pos <end_pos>
+--replace_column 2 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+--eval show binlog events from $start_pos limit 3,1
diff --git a/mysql-test/t/rpl_packet.test b/mysql-test/t/rpl_packet.test
index d01979a4731..9bda014f0e3 100644
--- a/mysql-test/t/rpl_packet.test
+++ b/mysql-test/t/rpl_packet.test
@@ -29,6 +29,8 @@ connection slave;
sync_with_master;
eval select count(*) from `$db`.`t1` /* must be 1 */;
+SHOW STATUS LIKE 'Slave_running';
+select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
connection master;
eval drop database $db;
save_master_pos;
@@ -36,4 +38,43 @@ save_master_pos;
connection slave;
sync_with_master;
+#
+# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits
+#
+# Check that a situation when the size of event on the master is greater than
+# max_allowed_packet on the slave does not lead to infinite re-transmits.
+
+connection master;
+
+# Change the max packet size on master
+
+SET @@global.max_allowed_packet=4096;
+SET @@global.net_buffer_length=4096;
+
+# Restart slave for new setting to take effect
+connection slave;
+STOP SLAVE;
+START SLAVE;
+
+# Reconnect to master for new setting to take effect
+disconnect master;
+connect (master, localhost, root)
+connection master;
+
+CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
+
+# The slave I/O thread must stop after trying to read the above event
+connection slave;
+sleep 2;
+SHOW STATUS LIKE 'Slave_running';
+
+# cleanup
+#connection master;
+#drop table t1;
+#connection slave;
+#drop table t1;
+
+
# End of tests
diff --git a/mysql-test/t/rpl_rbr_to_sbr.test b/mysql-test/t/rpl_rbr_to_sbr.test
index 4def515eb13..4f72996671d 100644
--- a/mysql-test/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/t/rpl_rbr_to_sbr.test
@@ -43,5 +43,5 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp
# 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;
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
diff --git a/mysql-test/t/rpl_row_NOW.test b/mysql-test/t/rpl_row_NOW.test
index d0272b35c1f..c28b714277e 100644
--- a/mysql-test/t/rpl_row_NOW.test
+++ b/mysql-test/t/rpl_row_NOW.test
@@ -67,8 +67,8 @@ DROP DATABASE mysqltest1;
diff_files $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;
+--remove_file $MYSQLTEST_VARDIR/tmp/NOW_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
sync_slave_with_master;
# End of 5.1 test case
diff --git a/mysql-test/t/rpl_row_basic_11bugs-master.opt b/mysql-test/t/rpl_row_basic_11bugs-master.opt
index ad03cdaa6d1..ceba85f40e5 100644
--- a/mysql-test/t/rpl_row_basic_11bugs-master.opt
+++ b/mysql-test/t/rpl_row_basic_11bugs-master.opt
@@ -1 +1,2 @@
---binlog_ignore_db=test_ignore
+--binlog_ignore_db=test_ignore --innodb
+
diff --git a/mysql-test/t/rpl_row_basic_11bugs-slave.opt b/mysql-test/t/rpl_row_basic_11bugs-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_11bugs-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_basic_11bugs.test b/mysql-test/t/rpl_row_basic_11bugs.test
index 348b6d45f52..17f5848ceef 100644
--- a/mysql-test/t/rpl_row_basic_11bugs.test
+++ b/mysql-test/t/rpl_row_basic_11bugs.test
@@ -24,8 +24,7 @@ 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;
+source include/show_binlog_events.inc;
sync_slave_with_master;
--echo **** On Slave ****
SHOW DATABASES;
@@ -117,5 +116,69 @@ sync_slave_with_master;
SELECT HEX(a),b FROM t1;
connection master;
-DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+sync_slave_with_master;
+
+# BUG#22583: RBR between MyISAM and non-MyISAM tables containing a BIT
+# field does not work
+
+--echo ================ Test for BUG#22583 ================
+--disable_query_log
+--source include/master-slave-reset.inc
+--enable_query_log
+
+--echo **** On Master ****
+connection master;
+CREATE TABLE t1_myisam (k INT, a BIT(1), b BIT(9)) ENGINE=MYISAM;
+CREATE TABLE t1_innodb (k INT, a BIT(1), b BIT(9)) ENGINE=INNODB;
+CREATE TABLE t2_myisam (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=MYISAM;
+CREATE TABLE t2_innodb (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=INNODB;
+--echo **** On Slave ****
+sync_slave_with_master;
+ALTER TABLE t1_myisam ENGINE=INNODB;
+ALTER TABLE t1_innodb ENGINE=MYISAM;
+ALTER TABLE t2_myisam ENGINE=INNODB;
+ALTER TABLE t2_innodb ENGINE=MYISAM;
+
+--echo **** On Master ****
+connection master;
+INSERT INTO t1_myisam VALUES(1, b'0', 257);
+INSERT INTO t1_myisam VALUES(2, b'1', 256);
+INSERT INTO t1_innodb VALUES(1, b'0', 257);
+INSERT INTO t1_innodb VALUES(2, b'1', 256);
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+INSERT INTO t2_myisam VALUES(1, b'0', 9);
+INSERT INTO t2_myisam VALUES(2, b'1', 8);
+INSERT INTO t2_innodb VALUES(1, b'0', 9);
+INSERT INTO t2_innodb VALUES(2, b'1', 8);
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+
+--echo **** On Master ****
+connection master;
+UPDATE t1_myisam SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+UPDATE t1_innodb SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+UPDATE t2_myisam SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+UPDATE t2_innodb SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+
+--echo **** On Master ****
+connection master;
+DROP TABLE IF EXISTS t1_myisam, t1_innodb, t2_myisam, t2_innodb;
sync_slave_with_master;
diff --git a/mysql-test/t/rpl_row_create_table.test b/mysql-test/t/rpl_row_create_table.test
index 6afcae4b5e6..d1b26f9e3f4 100644
--- a/mysql-test/t/rpl_row_create_table.test
+++ b/mysql-test/t/rpl_row_create_table.test
@@ -21,7 +21,7 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
# 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;
+sync_slave_with_master;
--disable_query_log
set @storage_engine = @@global.storage_engine;
STOP SLAVE;
@@ -34,9 +34,9 @@ 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_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---query_vertical SHOW BINLOG EVENTS FROM 212
+--query_vertical SHOW BINLOG EVENTS FROM 216
--echo **** On Master ****
--query_vertical SHOW CREATE TABLE t1
--query_vertical SHOW CREATE TABLE t2
@@ -70,8 +70,9 @@ connection master;
--error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
# Shouldn't be written to the binary log
+--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 1118;
+SHOW BINLOG EVENTS FROM 1098;
# Test that INSERT-SELECT works the same way as for SBR.
CREATE TABLE t7 (a INT, b INT UNIQUE);
@@ -79,8 +80,9 @@ CREATE TABLE t7 (a INT, b INT UNIQUE);
INSERT INTO t7 SELECT a,b FROM tt3;
SELECT * FROM t7 ORDER BY a,b;
# Should be written to the binary log
+--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 1118;
+SHOW BINLOG EVENTS FROM 1098;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
@@ -90,8 +92,9 @@ INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
BEGIN;
INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
+--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 1314;
+SHOW BINLOG EVENTS FROM 1294;
SELECT * FROM t7 ORDER BY a,b;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
@@ -105,8 +108,9 @@ CREATE TEMPORARY TABLE tt7 SELECT 1;
--echo **** On Master ****
--query_vertical SHOW CREATE TABLE t8
--query_vertical SHOW CREATE TABLE t9
+--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 1410;
+SHOW BINLOG EVENTS FROM 1390;
sync_slave_with_master;
--echo **** On Slave ****
--query_vertical SHOW CREATE TABLE t8
@@ -156,6 +160,7 @@ SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
SELECT * FROM t3 ORDER BY a;
SELECT * FROM t4 ORDER BY a;
+--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS;
sync_slave_with_master;
@@ -201,6 +206,7 @@ INSERT INTO t2 SELECT a+2 FROM tt1;
COMMIT;
SELECT * FROM t2 ORDER BY a;
+--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS;
sync_slave_with_master;
@@ -219,8 +225,9 @@ INSERT INTO t2 SELECT a+2 FROM tt2;
ROLLBACK;
SELECT * FROM t2 ORDER BY a;
+--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 627;
+SHOW BINLOG EVENTS FROM 631;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
diff --git a/mysql-test/t/rpl_row_flsh_tbls.test b/mysql-test/t/rpl_row_flsh_tbls.test
index 9e8efc1ac9c..a2f9e31fc5d 100644
--- a/mysql-test/t/rpl_row_flsh_tbls.test
+++ b/mysql-test/t/rpl_row_flsh_tbls.test
@@ -1,7 +1,7 @@
# depends on the binlog output
-- source include/have_binlog_format_row.inc
-let $rename_event_pos= 615;
+let $rename_event_pos= 619;
# 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
diff --git a/mysql-test/t/rpl_row_mysqlbinlog.test b/mysql-test/t/rpl_row_mysqlbinlog.test
index 3b4c8db86d8..f7158107e4c 100644
--- a/mysql-test/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/t/rpl_row_mysqlbinlog.test
@@ -162,12 +162,12 @@ connection master;
# this test for position option
-# By setting this position to 412, we should only get the create of t3
+# By setting this position to 413, 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
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 $MYSQLTEST_VARDIR/log/master-bin.000001
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -263,7 +263,7 @@ select "--- Test 6 reading stdin --" as "";
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
+--exec $MYSQL_BINLOG --short-form --position=416 - < $MYSQLTEST_VARDIR/log/master-bin.000001
# Bug#16217 (mysql client did not know how not switch its internal charset)
--disable_query_log
diff --git a/mysql-test/t/rpl_row_sp001.test b/mysql-test/t/rpl_row_sp001.test
index c6fc29e3750..c12e73b6861 100644
--- a/mysql-test/t/rpl_row_sp001.test
+++ b/mysql-test/t/rpl_row_sp001.test
@@ -140,7 +140,7 @@ sync_slave_with_master;
diff_files $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;
+--remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp011.test b/mysql-test/t/rpl_row_sp011.test
index fb87249d93c..25c2fc9ad26 100644
--- a/mysql-test/t/rpl_row_sp011.test
+++ b/mysql-test/t/rpl_row_sp011.test
@@ -105,7 +105,7 @@ sync_slave_with_master;
diff_files $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;
+--remove_file $MYSQLTEST_VARDIR/tmp/sp011_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
# End of 5.0 test case
diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test
index 9230b3bff4f..84154e549b8 100644
--- a/mysql-test/t/rpl_sp.test
+++ b/mysql-test/t/rpl_sp.test
@@ -566,7 +566,7 @@ connection master;
# were written to the binary log.
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events in 'master-bin.000001' from 102;
+show binlog events in 'master-bin.000001' from 106;
# Restore log_bin_trust_function_creators to its original value.
diff --git a/mysql-test/t/rpl_ssl.test b/mysql-test/t/rpl_ssl.test
index 9f25f71525a..dd03d5533b0 100644
--- a/mysql-test/t/rpl_ssl.test
+++ b/mysql-test/t/rpl_ssl.test
@@ -54,7 +54,16 @@ while ($i)
start slave;
enable_query_log;
connection master;
+# INSERT one more record to make sure
+# the sync has something to do
+insert into t1 values (NULL);
sync_slave_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
query_vertical show slave status;
+
+connection master;
+drop user replssl@localhost;
+drop table t1;
+sync_slave_with_master;
+
diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_ssl1.test
index edef603f617..6ca1484bb17 100644
--- a/mysql-test/t/rpl_openssl.test
+++ b/mysql-test/t/rpl_ssl1.test
@@ -46,7 +46,7 @@ select * from t1;
#checking show slave status
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
#checking if replication works without ssl also performing clean up
stop slave;
@@ -60,6 +60,38 @@ connection slave;
sync_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
# End of 4.1 tests
+
+# Start replication with ssl_verify_server_cert turned on
+connection slave;
+stop slave;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval change master to
+ master_host="localhost",
+ master_ssl=1 ,
+ master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem',
+ master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem',
+ master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem',
+ master_ssl_verify_server_cert=1;
+start slave;
+
+connection master;
+create table t1 (t int);
+insert into t1 values (1);
+
+sync_slave_with_master;
+
+echo on slave;
+#checking that replication is ok
+select * from t1;
+
+#checking show slave status
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
+query_vertical show slave status;
+
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_stm_flsh_tbls.test b/mysql-test/t/rpl_stm_flsh_tbls.test
index 43a5234ccc7..a8a33d05e8b 100644
--- a/mysql-test/t/rpl_stm_flsh_tbls.test
+++ b/mysql-test/t/rpl_stm_flsh_tbls.test
@@ -1,7 +1,7 @@
# depends on the binlog output
--source include/have_binlog_format_mixed_or_statement.inc
-let $rename_event_pos= 652;
+let $rename_event_pos= 656;
-- source extra/rpl_tests/rpl_flsh_tbls.test
# End of 4.1 tests
diff --git a/mysql-test/t/rpl_switch_stm_row_mixed.test b/mysql-test/t/rpl_switch_stm_row_mixed.test
index 494e73fda49..b0012827db8 100644
--- a/mysql-test/t/rpl_switch_stm_row_mixed.test
+++ b/mysql-test/t/rpl_switch_stm_row_mixed.test
@@ -519,9 +519,7 @@ 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;
+source include/show_binlog_events.inc;
sync_slave_with_master;
# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
@@ -536,9 +534,7 @@ sync_slave_with_master;
diff_files $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;
+source include/show_binlog_events.inc;
# Now test that mysqlbinlog works fine on a binlog generated by the
# mixed mode
diff --git a/mysql-test/t/rpl_udf.test b/mysql-test/t/rpl_udf.test
new file mode 100644
index 00000000000..262ad04630c
--- /dev/null
+++ b/mysql-test/t/rpl_udf.test
@@ -0,0 +1,22 @@
+###################################################################
+# Author: Chuck Bell #
+# Date: 2006-12-21 #
+# Purpose: To test that UDFs are replicated in both row based and #
+# statement based format. This tests work completed in WL#3629. #
+###################################################################
+
+--source include/not_embedded.inc
+--source include/master-slave.inc
+
+let $engine_type= MyISAM;
+
+set binlog_format=row;
+
+# Embedded server doesn't support binlogging
+--source include/rpl_udf.inc
+
+set binlog_format=statement;
+
+# Embedded server doesn't support binlogging
+--source include/rpl_udf.inc
+
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index f7f458e277c..1f8a00409e6 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -3299,4 +3299,64 @@ SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
DROP TABLE t1,t2;
+
+#
+# Bug #26963: join with predicates that contain fields from equalities evaluated
+# to constants after constant table substitution
+#
+
+CREATE TABLE t1 (
+ access_id int NOT NULL default '0',
+ name varchar(20) default NULL,
+ rank int NOT NULL default '0',
+ KEY idx (access_id)
+);
+
+CREATE TABLE t2 (
+ faq_group_id int NOT NULL default '0',
+ faq_id int NOT NULL default '0',
+ access_id int default NULL,
+ UNIQUE KEY idx1 (faq_id),
+ KEY idx2 (faq_group_id,faq_id)
+);
+
+INSERT INTO t1 VALUES
+ (1,'Everyone',2),(2,'Help',3),(3,'Technical Support',1),(4,'Chat User',4);
+INSERT INTO t2 VALUES
+ (261,265,1),(490,494,1);
+
+
+SELECT t2.faq_id
+ FROM t1 INNER JOIN t2 IGNORE INDEX (idx1)
+ ON (t1.access_id = t2.access_id)
+ LEFT JOIN t2 t
+ ON (t.faq_group_id = t2.faq_group_id AND
+ find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
+ WHERE
+ t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
+
+SELECT t2.faq_id
+ FROM t1 INNER JOIN t2
+ ON (t1.access_id = t2.access_id)
+ LEFT JOIN t2 t
+ ON (t.faq_group_id = t2.faq_group_id AND
+ find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
+ WHERE
+ t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
+
+DROP TABLE t1,t2;
+
+
+#
+# Bug #19372: Optimizer does not use index anymore when WHERE index NOT IN
+# () is added
+#
+CREATE TABLE t1 (a INT, b INT, KEY inx (b,a));
+
+INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (1, 6), (1,7);
+EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2
+ ON ( f1.b=f2.b AND f1.a<f2.a )
+ WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 91832ee8af4..60e680c63f3 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -392,7 +392,8 @@ SHOW TABLE STATUS like 't1';
--error 1033
show create table t1;
drop table if exists t1;
-system rm -f $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--error 1,0
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
#
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test
index 6dda97fcf8a..5e0fc65bc34 100644
--- a/mysql-test/t/skip_grants.test
+++ b/mysql-test/t/skip_grants.test
@@ -108,3 +108,17 @@ DROP PROCEDURE p3;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
+
+#
+# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
+#
+--error ER_OPTION_PREVENTS_STATEMENT
+set global event_scheduler=1;
+
+#
+# Bug#26285 Selecting information_schema crahes server
+#
+select count(*) from information_schema.COLUMN_PRIVILEGES;
+select count(*) from information_schema.SCHEMA_PRIVILEGES;
+select count(*) from information_schema.TABLE_PRIVILEGES;
+select count(*) from information_schema.USER_PRIVILEGES;
diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test
index 97bc29fcad2..1b33680cfaf 100644
--- a/mysql-test/t/sp-code.test
+++ b/mysql-test/t/sp-code.test
@@ -447,3 +447,21 @@ DROP PROCEDURE p1;
--echo End of 5.0 tests.
+
+#
+# Bug #26303: reserve() not called before qs_append() may lead to buffer
+# overflow
+#
+DELIMITER //;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE dummy int default 0;
+
+ CASE 12
+ WHEN 12
+ THEN SET dummy = 0;
+ END CASE;
+END//
+DELIMITER ;//
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index 375d2289459..df07091d2de 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -12,13 +12,10 @@
# 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
-
# Backup proc table
---system rm -rf $MYSQLTEST_VARDIR/master-data/mysql/backup
---system mkdir $MYSQLTEST_VARDIR/master-data/mysql/backup
---system cp $MYSQLTEST_VARDIR/master-data/mysql/proc.* $MYSQLTEST_VARDIR/master-data/mysql/backup/
+--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
+--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
use test;
@@ -53,22 +50,25 @@ insert into t1 values (0);
flush table mysql.proc;
# Thrashing the .frm file
---system echo 'saljdlfa' > $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
---replace_result $MYSQLTEST_VARDIR . master-data// ''
+--write_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
+saljdfa
+EOF
+--replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
--error ER_NOT_FORM_FILE
call bug14233();
---replace_result $MYSQLTEST_VARDIR . master-data// ''
+--replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
--error ER_NOT_FORM_FILE
create view v1 as select bug14233_f();
---replace_result $MYSQLTEST_VARDIR . master-data// ''
+--replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
--error ER_NOT_FORM_FILE
insert into t1 values (0);
-
flush table mysql.proc;
# Drop the mysql.proc table
---system rm $MYSQLTEST_VARDIR/master-data/mysql/proc.*
+--remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD
+--remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI
--error ER_NO_SUCH_TABLE
call bug14233();
--error ER_NO_SUCH_TABLE
@@ -77,8 +77,12 @@ create view v1 as select bug14233_f();
insert into t1 values (0);
# Restore mysql.proc
---system mv $MYSQLTEST_VARDIR/master-data/mysql/backup/* $MYSQLTEST_VARDIR/master-data/mysql/
---system rmdir $MYSQLTEST_VARDIR/master-data/mysql/backup
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI
+--remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
+--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
+--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI
flush table mysql.proc;
flush privileges;
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 6dc94869f04..e5de4a570cb 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -2068,6 +2068,74 @@ drop function bug20701;
#
+# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
+#
+
+delimiter //;
+
+--error ER_SP_LILABEL_MISMATCH
+create procedure proc_26503_error_1()
+begin
+retry:
+ repeat
+ begin
+ declare continue handler for sqlexception
+ begin
+ iterate retry;
+ end
+
+ select "do something";
+ end
+ until true end repeat retry;
+end//
+
+--error ER_SP_LILABEL_MISMATCH
+create procedure proc_26503_error_2()
+begin
+retry:
+ repeat
+ begin
+ declare continue handler for sqlexception
+ iterate retry;
+
+ select "do something";
+ end
+ until true end repeat retry;
+end//
+
+--error ER_SP_LILABEL_MISMATCH
+create procedure proc_26503_error_3()
+begin
+retry:
+ repeat
+ begin
+ declare continue handler for sqlexception
+ begin
+ leave retry;
+ end
+
+ select "do something";
+ end
+ until true end repeat retry;
+end//
+
+--error ER_SP_LILABEL_MISMATCH
+create procedure proc_26503_error_4()
+begin
+retry:
+ repeat
+ begin
+ declare continue handler for sqlexception
+ leave retry;
+
+ select "do something";
+ end
+ until true end repeat retry;
+end//
+
+delimiter ;//
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index f994f61a665..91de14116d4 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -28,6 +28,7 @@ drop procedure db1_secret.dummy;
use db1_secret;
create table t1 ( u varchar(64), i int );
+insert into t1 values('test', 0);
# A test procedure and function
create procedure stamp(i int)
@@ -35,7 +36,16 @@ create procedure stamp(i int)
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like 'stamp';
-create function db() returns varchar(64) return database();
+delimiter |;
+create function db() returns varchar(64)
+begin
+ declare v varchar(64);
+
+ select u into v from t1 limit 1;
+
+ return v;
+end|
+delimiter ;|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show function status like 'db';
@@ -63,14 +73,18 @@ call db1_secret.stamp(2);
select db1_secret.db();
# ...but not this
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from db1_secret.t1;
# ...and not this
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
create procedure db1_secret.dummy() begin end;
---error 1305
+--error ER_SP_DOES_NOT_EXIST
drop procedure db1_secret.dummy;
+--error ER_PROCACCESS_DENIED_ERROR
+drop procedure db1_secret.stamp;
+--error ER_PROCACCESS_DENIED_ERROR
+drop function db1_secret.db;
#
@@ -83,14 +97,18 @@ call db1_secret.stamp(3);
select db1_secret.db();
# ...but not this
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from db1_secret.t1;
# ...and not this
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
create procedure db1_secret.dummy() begin end;
---error 1305
+--error ER_SP_DOES_NOT_EXIST
drop procedure db1_secret.dummy;
+--error ER_PROCACCESS_DENIED_ERROR
+drop procedure db1_secret.stamp;
+--error ER_PROCACCESS_DENIED_ERROR
+drop function db1_secret.db;
#
@@ -121,9 +139,9 @@ select db();
connection con2user1;
# This should not work
---error 1044
+--error ER_TABLEACCESS_DENIED_ERROR
call db1_secret.stamp(5);
---error 1044
+--error ER_TABLEACCESS_DENIED_ERROR
select db1_secret.db();
#
@@ -132,9 +150,9 @@ select db1_secret.db();
connection con3anon;
# This should not work
---error 1044
+--error ER_TABLEACCESS_DENIED_ERROR
call db1_secret.stamp(6);
---error 1044
+--error ER_TABLEACCESS_DENIED_ERROR
select db1_secret.db();
#
@@ -165,7 +183,7 @@ use db2;
create procedure p () insert into t2 values (1);
# Check that this doesn't work.
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
call p();
connect (con4user2,localhost,user2,,);
@@ -174,7 +192,7 @@ connection con4user2;
use db2;
# This should not work, since p is executed with definer's (user1's) rights.
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
call p();
select * from t2;
@@ -207,9 +225,9 @@ alter procedure p modifies sql data;
drop procedure p;
# This should NOT work
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
alter procedure q modifies sql data;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure q;
connection con1root;
@@ -260,30 +278,30 @@ connect (con4userc,localhost,userc,,);
connection con2usera;
call sptest.p1(1);
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
grant execute on procedure sptest.p1 to userb@localhost;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure sptest.p1;
connection con3userb;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
call sptest.p1(2);
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
grant execute on procedure sptest.p1 to userb@localhost;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure sptest.p1;
connection con4userc;
call sptest.p1(3);
grant execute on procedure sptest.p1 to userb@localhost;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure sptest.p1;
connection con3userb;
call sptest.p1(4);
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
grant execute on procedure sptest.p1 to userb@localhost;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure sptest.p1;
connection con1root;
@@ -332,7 +350,7 @@ delimiter ;//
connect (user1,localhost,user1,,test);
connection user1;
use mysqltest;
--- error 1370
+-- error ER_PROCACCESS_DENIED_ERROR
select bug_9503();
connection root;
@@ -401,13 +419,13 @@ grant usage on *.* to mysqltest_1@localhost;
connect (n1,localhost,mysqltest_1,,information_schema,$MASTER_MYPORT,$MASTER_MYSOCK);
connection n1;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
call mysqltest_1.p1();
disconnect n1;
# Test also without a current database
connect (n2,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
connection n2;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
call mysqltest_1.p1();
disconnect n2;
@@ -433,9 +451,9 @@ end;
create user user_bug12812@localhost IDENTIFIED BY 'ABC'|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (test_user_12812,localhost,user_bug12812,ABC,test)|
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
SELECT test.bug12812()|
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT test.bug12812()|
# Cleanup
connection default|
@@ -489,7 +507,8 @@ drop database db_bug14834;
#
-# BUG#14533: 'desc tbl' in stored procedure causes error 1142
+# BUG#14533: 'desc tbl' in stored procedure causes error
+# ER_TABLEACCESS_DENIED_ERROR
#
create database db_bug14533;
use db_bug14533;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 884519801e2..591677cd834 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -706,9 +706,11 @@ begin
insert into test.t1 values (concat(x, "2"), y+2);
end|
---system rm -f $MYSQLTEST_VARDIR/tmp/spout
+# Remove spout file if it exists
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/tmp/spout
call into_outfile("ofile", 1)|
---system rm -f $MYSQLTEST_VARDIR/tmp/spout
+--remove_file $MYSQLTEST_VARDIR/tmp/spout
delete from t1|
drop procedure into_outfile|
@@ -723,9 +725,11 @@ begin
insert into test.t1 values (concat(x, "2"), y+2);
end|
---system rm -f $MYSQLTEST_VARDIR/tmp/spdump
+# Remove spdump file if it exists
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/tmp/spdump
call into_dumpfile("dfile", 1)|
---system rm -f $MYSQLTEST_VARDIR/tmp/spdump
+--remove_file $MYSQLTEST_VARDIR/tmp/spdump
delete from t1|
drop procedure into_dumpfile|
@@ -6564,6 +6568,46 @@ call proc_21462_b(1)|
drop procedure proc_21462_a|
drop procedure proc_21462_b|
+
+#
+# BUG#20492: Subsequent calls to stored procedure yeild incorrect
+# result if join is used
+#
+# Optimized ON expression in join wasn't properly saved for reuse.
+#
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1|
+DROP VIEW IF EXISTS v1, v2|
+DROP TABLE IF EXISTS t3, t4|
+--enable_warnings
+
+CREATE TABLE t3 (t3_id INT)|
+
+INSERT INTO t3 VALUES (0)|
+INSERT INTO t3 VALUES (1)|
+
+CREATE TABLE t4 (t4_id INT)|
+
+INSERT INTO t4 VALUES (2)|
+
+CREATE VIEW v1 AS
+SELECT t3.t3_id, t4.t4_id
+FROM t3 JOIN t4 ON t3.t3_id = 0|
+
+CREATE VIEW v2 AS
+SELECT t3.t3_id AS t3_id_1, v1.t3_id AS t3_id_2, v1.t4_id
+FROM t3 LEFT JOIN v1 ON t3.t3_id = 0|
+
+CREATE PROCEDURE p1() SELECT * FROM v2|
+
+# Results should not differ.
+CALL p1()|
+CALL p1()|
+
+DROP PROCEDURE p1|
+DROP VIEW v1, v2|
+DROP TABLE t3, t4|
+
--echo End of 5.0 tests
--echo Begin of 5.1 tests
@@ -6828,6 +6872,141 @@ drop function func_8407_a|
drop function func_8407_b|
#
+# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
+#
+
+--disable_warnings
+drop table if exists table_26503|
+drop procedure if exists proc_26503_ok_1|
+drop procedure if exists proc_26503_ok_2|
+drop procedure if exists proc_26503_ok_3|
+drop procedure if exists proc_26503_ok_4|
+--enable_warnings
+
+create table table_26503(a int unique)|
+
+create procedure proc_26503_ok_1(v int)
+begin
+ declare i int default 5;
+
+ declare continue handler for sqlexception
+ begin
+ select 'caught something';
+ retry:
+ while i > 0 do
+ begin
+ set i = i - 1;
+ select 'looping', i;
+ iterate retry;
+ select 'dead code';
+ end;
+ end while retry;
+ select 'leaving handler';
+ end;
+
+ select 'do something';
+ insert into table_26503 values (v);
+ select 'do something again';
+ insert into table_26503 values (v);
+end|
+
+create procedure proc_26503_ok_2(v int)
+begin
+ declare i int default 5;
+
+ declare continue handler for sqlexception
+ begin
+ select 'caught something';
+ retry:
+ while i > 0 do
+ begin
+ set i = i - 1;
+ select 'looping', i;
+ leave retry;
+ select 'dead code';
+ end;
+ end while;
+ select 'leaving handler';
+ end;
+
+ select 'do something';
+ insert into table_26503 values (v);
+ select 'do something again';
+ insert into table_26503 values (v);
+end|
+
+## The outer retry label should not prevent using the inner label.
+
+create procedure proc_26503_ok_3(v int)
+begin
+ declare i int default 5;
+
+retry:
+ begin
+ declare continue handler for sqlexception
+ begin
+ select 'caught something';
+ retry:
+ while i > 0 do
+ begin
+ set i = i - 1;
+ select 'looping', i;
+ iterate retry;
+ select 'dead code';
+ end;
+ end while retry;
+ select 'leaving handler';
+ end;
+
+ select 'do something';
+ insert into table_26503 values (v);
+ select 'do something again';
+ insert into table_26503 values (v);
+ end;
+end|
+
+## The outer retry label should not prevent using the inner label.
+
+create procedure proc_26503_ok_4(v int)
+begin
+ declare i int default 5;
+
+retry:
+ begin
+ declare continue handler for sqlexception
+ begin
+ select 'caught something';
+ retry:
+ while i > 0 do
+ begin
+ set i = i - 1;
+ select 'looping', i;
+ leave retry;
+ select 'dead code';
+ end;
+ end while;
+ select 'leaving handler';
+ end;
+
+ select 'do something';
+ insert into table_26503 values (v);
+ select 'do something again';
+ insert into table_26503 values (v);
+ end;
+end|
+
+call proc_26503_ok_1(1)|
+call proc_26503_ok_2(2)|
+call proc_26503_ok_3(3)|
+call proc_26503_ok_4(4)|
+
+drop table table_26503|
+drop procedure proc_26503_ok_1|
+drop procedure proc_26503_ok_2|
+drop procedure proc_26503_ok_3|
+drop procedure proc_26503_ok_4|
+
+#
# Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
# result.
#
@@ -6842,10 +7021,96 @@ INSERT INTO t3 VALUES (1, 3.4), (1, 2), (1, 0.9), (2, 8), (2, 7)|
SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
DROP FUNCTION bug25373|
DROP TABLE t3|
+
+
#
-# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
-# at the end of the file!
+# BUG#25082: Default database change on trigger execution breaks replication.
+#
+# As it turned out, this bug has actually two bugs. So, here we have two test
+# cases -- one in sp.test, the other in sp-security.test.
+#
+
+#
+# Test case 1: error on dropping the current database.
+#
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1|
+CREATE DATABASE mysqltest2|
+
+# Test.
+
+CREATE PROCEDURE mysqltest1.p1()
+ DROP DATABASE mysqltest2|
+
+use mysqltest2|
+
+CALL mysqltest1.p1()|
+
+SELECT DATABASE()|
+
+# Cleanup.
+
+DROP DATABASE mysqltest1|
+
+use test|
+
+
#
+# Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
+--disable_warnings
+drop function if exists bug20777|
+drop table if exists examplebug20777|
+--enabled_warnings
+create function bug20777(f1 bigint unsigned) returns bigint unsigned
+begin
+ set f1 = (f1 - 10); set f1 = (f1 + 10);
+return f1;
+end|
+delimiter ;|
+select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
+select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
+select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
+select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
+select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
+select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
+select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
+select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
+select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
+select bug20777(9223372036854775807) as 'upper bounds signed bigint';
+select bug20777(0) as 'lower bounds unsigned bigint';
+select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
+select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
+select bug20777(-1) as 'lower bounds unsigned bigint - 1';
+
+create table examplebug20777 as select
+ 0 as 'i',
+ bug20777(9223372036854775806) as '2**63-2',
+ bug20777(9223372036854775807) as '2**63-1',
+ bug20777(9223372036854775808) as '2**63',
+ bug20777(9223372036854775809) as '2**63+1',
+ bug20777(18446744073709551614) as '2**64-2',
+ bug20777(18446744073709551615) as '2**64-1',
+ bug20777(18446744073709551616) as '2**64',
+ bug20777(0) as '0',
+ bug20777(-1) as '-1';
+insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
+show create table examplebug20777;
+select * from examplebug20777 order by i;
+
+drop table examplebug20777;
+select bug20777(18446744073709551613)+1;
+drop function bug20777;
+delimiter |;
+
+###
+--echo End of 5.0 tests.
#
# BUG#NNNN: New bug synopsis
@@ -6854,8 +7119,36 @@ DROP TABLE t3|
#drop procedure if exists bugNNNN|
#--enable_warnings
#create procedure bugNNNN...
-
+#
# Add bugs above this line. Use existing tables t1 and t2 when
-# practical, or create table t3, t4 etc temporarily (and drop them).
+# practical, or create table t3,t4 etc temporarily (and drop them).
+# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
+# at the end of the file!
+#
+
delimiter ;|
drop table t1,t2;
+
+CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
+CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
+set @a=0;
+
+delimiter |;
+CREATE function bug27354() RETURNS int deterministic
+begin
+insert into t1 values (null);
+set @a=@a+1;
+return @a;
+end|
+
+delimiter ;|
+update t2 set b=1 where a=bug27354();
+select count(t_1.a),count(t_2.a) from t1 as t_1, t2 as t_2 /* must be 0,0 */;
+insert into t2 values (1,1),(2,2),(3,3);
+update t2 set b=-b where a=bug27354();
+select * from t2 /* must return 1,-1 ... */;
+select count(*) from t1 /* must be 3 */;
+
+
+drop table t1,t2;
+drop function bug27354;
diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test
new file mode 100644
index 00000000000..cc3b2531bed
--- /dev/null
+++ b/mysql-test/t/sp_trans_log.test
@@ -0,0 +1,43 @@
+# part of sp_trans test that appeared to be sensitive to binlog format
+--source include/have_innodb.inc
+--source include/have_binlog_format_mixed_or_row.inc
+
+delimiter |;
+
+#
+# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
+# Bug #23333 stored function + non-transac table + transac table =
+# breaks stmt-based binlog
+# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
+#
+--disable_warnings
+drop function if exists bug23333|
+drop table if exists t1,t2|
+--enable_warnings
+ CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
+ CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
+
+insert into t2 values (1,1)|
+
+create function bug23333()
+RETURNS int(11)
+DETERMINISTIC
+begin
+ insert into t1 values (null);
+ select count(*) from t1 into @a;
+ return @a;
+end|
+
+reset master|
+--error ER_DUP_ENTRY_WITH_KEY_NAME
+insert into t2 values (bug23333(),1)|
+--replace_column 2 # 5 # 6 #
+show binlog events from 106 /* with fixes for #23333 will show there is the query */|
+select count(*),@a from t1 /* must be 1,1 */|
+
+delimiter ;|
+
+# clean-up
+
+drop table t1,t2;
+drop function if exists bug23333;
diff --git a/mysql-test/t/ssl_des-master.opt b/mysql-test/t/ssl_des-master.opt
deleted file mode 100644
index 0b2b8cb85ac..00000000000
--- a/mysql-test/t/ssl_des-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose_ssl-cert=std_data/server-cert-des.pem --loose_ssl-key=std_data/server-key-des.pem
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index 2f35bbf22f2..fe731f4b0a1 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -14,7 +14,6 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
---error 1292
INSERT INTO t1 VALUES('0000-10-31');
# All test cases expected to fail should return
@@ -100,7 +99,6 @@ set @@sql_mode='ansi,traditional';
CREATE TABLE t1 (col1 datetime);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
---error 1292
INSERT INTO t1 VALUES('0000-10-31 15:30:00');
# All test cases expected to fail should return
@@ -194,7 +192,6 @@ INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
---error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
@@ -216,7 +213,6 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
---error 1292
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
@@ -271,7 +267,6 @@ INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
---error 1292
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
--error 1292
@@ -299,7 +294,6 @@ INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
---error 1292
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
--error 1292
@@ -367,7 +361,6 @@ INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
---error 1292
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
--error 1292
@@ -394,7 +387,6 @@ INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
---error 1292
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
--error 1292
@@ -1208,3 +1200,62 @@ create table t1 (i int)
comment '123456789*123456789*123456789*123456789*123456789*123456789*';
show create table t1;
drop table t1;
+
+#
+# Bug #26359: Strings becoming truncated and converted to numbers under STRICT mode
+#
+set sql_mode= 'traditional';
+create table t1(col1 tinyint, col2 tinyint unsigned,
+ col3 smallint, col4 smallint unsigned,
+ col5 mediumint, col6 mediumint unsigned,
+ col7 int, col8 int unsigned,
+ col9 bigint, col10 bigint unsigned);
+--error 1366
+insert into t1(col1) values('-');
+--error 1366
+insert into t1(col2) values('+');
+--error 1366
+insert into t1(col3) values('-');
+--error 1366
+insert into t1(col4) values('+');
+--error 1366
+insert into t1(col5) values('-');
+--error 1366
+insert into t1(col6) values('+');
+--error 1366
+insert into t1(col7) values('-');
+--error 1366
+insert into t1(col8) values('+');
+--error 1366
+insert into t1(col9) values('-');
+--error 1366
+insert into t1(col10) values('+');
+drop table t1;
+
+#
+# Bug #27176: Assigning a string to an year column has unexpected results
+#
+set sql_mode='traditional';
+create table t1(a year);
+--error 1366
+insert into t1 values ('-');
+--error 1366
+insert into t1 values ('+');
+--error 1366
+insert into t1 values ('');
+--error 1265
+insert into t1 values ('2000a');
+--error 1265
+insert into t1 values ('2E3x');
+drop table t1;
+
+#
+# Bug#27069 set with identical elements are created
+#
+set sql_mode='traditional';
+--error 1291
+create table t1 (f1 set('a','a'));
+--error 1291
+create table t1 (f1 enum('a','a'));
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 8ca99130921..3b7cc2abb73 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -2602,13 +2602,6 @@ SELECT * FROM t1
DROP TABLE t1,t2,t3;
-#
-# Bug#20835 (literal string with =any values)
-#
-CREATE TABLE t1 (s1 char(1));
-INSERT INTO t1 VALUES ('a');
-SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
-DROP TABLE t1;
#
# Bug#23800: Outer fields in correlated subqueries is used in a temporary
# table created for sorting.
@@ -2736,3 +2729,126 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t1xt2;
+#
+# Bug #26728: derived table with concatanation of literals in select list
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (3), (1), (2);
+
+SELECT 'this is ' 'a test.' AS col1, a AS col2 FROM t1;
+SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
+
+DROP table t1;
+
+#
+# Bug #27257: COUNT(*) aggregated in outer query
+#
+
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (m int, n int);
+INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
+INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
+
+SELECT COUNT(*), a,
+ (SELECT m FROM t2 WHERE m = count(*) LIMIT 1)
+ FROM t1 GROUP BY a;
+
+SELECT COUNT(*), a,
+ (SELECT MIN(m) FROM t2 WHERE m = count(*))
+ FROM t1 GROUP BY a;
+
+SELECT COUNT(*), a
+ FROM t1 GROUP BY a
+ HAVING (SELECT MIN(m) FROM t2 WHERE m = count(*)) > 1;
+
+DROP TABLE t1,t2;
+
+#
+# Bug #27229: GROUP_CONCAT in subselect with COUNT() as an argument
+#
+
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (m int, n int);
+INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
+INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
+
+SELECT COUNT(*) c, a,
+ (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a)
+ FROM t1 GROUP BY a;
+
+SELECT COUNT(*) c, a,
+ (SELECT GROUP_CONCAT(COUNT(a)+1) FROM t2 WHERE m = a)
+ FROM t1 GROUP BY a;
+
+DROP table t1,t2;
+
+#
+# Bug#27321: Wrong subquery result in a grouping select
+#
+CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
+INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
+(1,5,0,'e'), (2,1,0,'f'), (2,2,0,'g'), (2,3,0,'h'), (3,4,0,'i'), (3,3,0,'j'),
+(3,2,0,'k'), (3,1,0,'l'), (1,9,0,'m'), (1,0,10,'n'), (2,0,5,'o'), (3,0,7,'p');
+
+SELECT a, MAX(b),
+ (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
+ FROM t1 GROUP BY a;
+SELECT a x, MAX(b),
+ (SELECT t.c FROM t1 AS t WHERE x=t.a AND t.b=MAX(t1.b + 0)) as test
+ FROM t1 GROUP BY a;
+SELECT a, AVG(b),
+ (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test
+ FROM t1 WHERE t1.d=0 GROUP BY a;
+
+SELECT tt.a,
+ (SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+ LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+ FROM t1 as tt;
+
+SELECT tt.a,
+ (SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+ LIMIT 1)
+ FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+ FROM t1 as tt GROUP BY tt.a;
+
+SELECT tt.a, MAX(
+ (SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+ LIMIT 1)
+ FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
+ FROM t1 as tt GROUP BY tt.a;
+
+DROP TABLE t1;
+
+#
+# Bug #27348: SET FUNCTION used in a subquery from WHERE condition
+#
+
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
+
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
+
+SELECT a FROM t1 t0
+ WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
+
+SET @@sql_mode='ansi';
+--error 1111
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
+--error 1111
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
+
+--error 1111
+SELECT a FROM t1 t0
+ WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
+
+SET @@sql_mode=default;
+DROP TABLE t1;
+
+# Bug#20835 (literal string with =any values)
+#
+CREATE TABLE t1 (s1 char(1));
+INSERT INTO t1 VALUES ('a');
+SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
+DROP TABLE t1;
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index ed8480ba464..11468cd6759 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -489,3 +489,42 @@ select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1;
drop table t1,t2;
+#
+# Bug #24484: Aggregate function used in column list subquery gives erroneous
+# error
+#
+CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
+INSERT INTO t1 VALUES (1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
+ (2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'),(3,3,'j'), (3,2,'k'), (3,1,'l'),
+ (1,9,'m');
+CREATE TABLE t2 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
+INSERT INTO t2 SELECT * FROM t1;
+
+# Gives error, but should work since it is (a, b) is the PK so only one
+# given match possible
+SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b))
+ as test FROM t1 GROUP BY a;
+SELECT * FROM t1 GROUP by t1.a
+ HAVING (MAX(t1.b) > (SELECT MAX(t2.b) FROM t2 WHERE t2.c < t1.c
+ HAVING MAX(t2.b+t1.a) < 10));
+
+SELECT a,b,c FROM t1 WHERE b in (9,3,4) ORDER BY b,c;
+
+SELECT a, MAX(b),
+ (SELECT COUNT(DISTINCT t.c) FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)
+ LIMIT 1)
+ as cnt,
+ (SELECT t.b FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1)
+ as t_b,
+ (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1)
+ as t_b,
+ (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) ORDER BY t.c LIMIT 1)
+ as t_b
+ FROM t1 GROUP BY a;
+
+SELECT a, MAX(b),
+ (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as test
+ FROM t1 GROUP BY a;
+
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index d06fde87b34..e10fd386bd3 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -164,6 +164,21 @@ DROP TABLE t1;
--echo End of 4.1 tests.
+#
+# Bug #24791: Union with AVG-groups generates wrong results
+#
+CREATE TABLE t1 ( c FLOAT( 20, 14 ) );
+INSERT INTO t1 VALUES( 12139 );
+
+CREATE TABLE t2 ( c FLOAT(30,18) );
+INSERT INTO t2 VALUES( 123456 );
+
+SELECT AVG( c ) FROM t1 UNION SELECT 1;
+SELECT 1 UNION SELECT AVG( c ) FROM t1;
+SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1;
+SELECT c/1 FROM t1 UNION SELECT 1;
+
+DROP TABLE t1, t2;
#
# Test truncate with temporary tables
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
index 5e1f74d388f..4f70539ca8d 100644
--- a/mysql-test/t/timezone2.test
+++ b/mysql-test/t/timezone2.test
@@ -246,3 +246,31 @@ drop function f1;
SET GLOBAL log_bin_trust_function_creators = 0;
# End of 5.0 tests
+
+
+#
+# BUG#9953: CONVERT_TZ requires mysql.time_zone_name to be locked
+# BUG#19339: CONVERT_TZ(): overly aggressive in locking time_zone_name
+# table
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (t TIMESTAMP);
+INSERT INTO t1 VALUES (NULL), (NULL);
+
+LOCK TABLES t1 WRITE;
+
+# The following two queries should not return error that time zone
+# tables aren't locked. We use IS NULL below to supress timestamp
+# result.
+SELECT CONVERT_TZ(NOW(), 'UTC', 'Europe/Moscow') IS NULL;
+UPDATE t1 SET t = CONVERT_TZ(t, 'UTC', 'Europe/Moscow');
+
+UNLOCK TABLES;
+
+DROP TABLE t1;
+
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index 14608a3b193..55b67adf7c6 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -1699,4 +1699,42 @@ DROP TABLE bug22580_t1;
DROP PROCEDURE bug22580_proc_1;
DROP PROCEDURE bug22580_proc_2;
+#
+# Bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE
+#
+--disable_warnings
+DROP TRIGGER IF EXISTS trg27006_a_update;
+DROP TRIGGER IF EXISTS trg27006_a_insert;
+--enable_warnings
+
+CREATE TABLE t1 (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `val` varchar(10) NOT NULL,
+ PRIMARY KEY (`id`)
+);
+CREATE TABLE t2 like t1;
+DELIMITER |;
+
+CREATE TRIGGER trg27006_a_insert AFTER INSERT ON t1 FOR EACH ROW
+BEGIN
+ insert into t2 values (NULL,new.val);
+END |
+CREATE TRIGGER trg27006_a_update AFTER UPDATE ON t1 FOR EACH ROW
+BEGIN
+ insert into t2 values (NULL,new.val);
+END |
+DELIMITER ;|
+
+INSERT INTO t1(val) VALUES ('test1'),('test2');
+SELECT * FROM t1;
+SELECT * FROM t2;
+INSERT INTO t1 VALUES (2,'test2') ON DUPLICATE KEY UPDATE val=VALUES(val);
+INSERT INTO t1 VALUES (2,'test3') ON DUPLICATE KEY UPDATE val=VALUES(val);
+INSERT INTO t1 VALUES (3,'test4') ON DUPLICATE KEY UPDATE val=VALUES(val);
+SELECT * FROM t1;
+SELECT * FROM t2;
+DROP TRIGGER trg27006_a_insert;
+DROP TRIGGER trg27006_a_update;
+drop table t1,t2;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index f806bd8ec17..c52260124cb 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -52,3 +52,35 @@ SELECT * from t1;
drop table t1;
# End of 4.1 tests
+
+# Test for Bug#5507 "TRUNCATE should work with views"
+
+create table t1 (s1 int);
+
+insert into t1 (s1) values (1), (2), (3), (4), (5);
+create view v1 as select * from t1;
+truncate table v1;
+select count(*) from t1;
+
+insert into t1 (s1) values (1), (2), (3), (4), (5);
+create view v2 as select * from t1 where s1 > 3;
+truncate table v2;
+select * from t1;
+select * from v2;
+delete from t1;
+
+# The following should fail
+create table t2 (s1 int, s2 int);
+create view v3 as select a.s1, b.s2 from t1 a join t2 b on a.s1 = b.s1 where a.s1 > 3;
+--error 1395
+truncate table v3;
+
+# The following should fail
+create view v4 as select * from t1 limit 1,1;
+--error 1288
+truncate table v4;
+
+drop view v1, v2, v3, v4;
+drop table t1, t2;
+
+# End of 5.0 tests
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index c6050753943..02cd07e3c16 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -123,3 +123,16 @@ insert into t1 values ('2000-01-01','2000-01-02');
select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #23093: Implicit conversion of 9912101 to date does not match
+# cast(9912101 as date)
+#
+select @d:=1111, year(@d), month(@d), day(@d), cast(@d as date);
+select @d:=011111, year(@d), month(@d), day(@d), cast(@d as date);
+select @d:=1311, year(@d), month(@d), day(@d), cast(@d as date);
+create table t1 (d date , dt datetime , ts timestamp);
+insert into t1 values (9912101,9912101,9912101);
+insert into t1 values (11111,11111,11111);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 3aa162b4700..b4c10408b37 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -113,6 +113,12 @@ insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
select * from t1;
drop table t1;
+#
+# Bug #16546 DATETIME+0 not always coerced the same way
+#
+select cast('2006-12-05 22:10:10' as datetime) + 0;
+
+
# End of 4.1 tests
#
@@ -135,3 +141,25 @@ SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6));
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
+#
+# Test of storing datetime into date fields
+#
+
+set @org_mode=@@sql_mode;
+create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
+show create table t1;
+insert into t1 values ();
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+set @@sql_mode='ansi,traditional';
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+insert into t1 set dt='2007-03-23 13:49:38',da=dt;
+# Test error handling
+--error 1292
+insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
+select * from t1;
+drop table t1;
+--error 1067
+create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
+--error 1067
+create table t1 (t time default '916:00:00 a');
+set @@sql_mode= @org_mode;
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index f16e5dec40c..b8c05d62720 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1127,6 +1127,22 @@ select * from t1;
drop table t1;
#
+# Bug #8663 (cant use bigint as input to CAST)
+#
+select cast(19999999999999999999 as unsigned);
+
+#
+# Bug #24558: Increasing decimal column length causes data loss
+#
+create table t1(a decimal(18));
+insert into t1 values(123456789012345678);
+alter table t1 modify column a decimal(19);
+select * from t1;
+drop table t1;
+
+--echo End of 5.0 tests
+
+#
# Bug#16172 DECIMAL data type processed incorrectly
#
select cast(143.481 as decimal(4,1));
@@ -1136,8 +1152,3 @@ 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));
-
-# Bug #8663 (cant use bigint as input to CAST)
-#
-select cast(19999999999999999999 as unsigned);
-
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
index 56df3328246..b1c816f3371 100644
--- a/mysql-test/t/type_set.test
+++ b/mysql-test/t/type_set.test
@@ -39,3 +39,20 @@ SELECT c FROM t1 ORDER BY concat(c);
DROP TABLE t1;
# End of 4.1 tests
+
+#
+# Bug#27069 set with identical elements are created
+#
+--error 1097
+create table t1(f1
+set('1','2','3','4','5','6','7','8','9','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','54','55','56','57','58','59','60','61','62','63','64','128'));
+create table t1(f1
+set('1','2','3','4','5','6','7','8','9','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','54','55','56','57','58','59','60','61','62','63','64','1'));
+show create table t1;
+drop table t1;
diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test
index 9744da24c02..0e174a556d6 100644
--- a/mysql-test/t/type_year.test
+++ b/mysql-test/t/type_year.test
@@ -21,4 +21,12 @@ insert into t1 values (now());
select if(y = now(), 1, 0) from t1;
drop table t1;
-# End of 4.1 tests
+#
+# Bug #27176: Assigning a string to an year column has unexpected results
+#
+create table t1(a year);
+insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3');
+select * from t1;
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index cc93fbd715a..a57ab469ac2 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -913,4 +913,13 @@ SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test;
DROP TABLE t1;
+#
+# Bug#23345: Wrongly allowed INTO in a non-last select of a UNION.
+#
+--error 1221
+(select 1 into @var) union (select 1);
+(select 1) union (select 1 into @var);
+select @var;
+--error 1172
+(select 2) union (select 1 into @var);
--echo End of 5.0 tests
diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test
index ce1a476eb43..3ce01a0927b 100644
--- a/mysql-test/t/user_var-binlog.test
+++ b/mysql-test/t/user_var-binlog.test
@@ -13,9 +13,8 @@ INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa";
SET @var2=char(ascii('a'));
insert into t1 values (@var1),(@var2);
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events from 102;
+source include/show_binlog_events.inc;
+
# 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 d381ed62bc7..12d8a89fd08 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -540,6 +540,30 @@ set lc_time_names=0;
select @@lc_time_names;
#
+# Bug #22648 LC_TIME_NAMES: Setting GLOBAL has no effect
+#
+select @@global.lc_time_names, @@lc_time_names;
+set @@global.lc_time_names=fr_FR;
+select @@global.lc_time_names, @@lc_time_names;
+--echo New connection
+connect (con1,localhost,root,,);
+connection con1;
+select @@global.lc_time_names, @@lc_time_names;
+set @@lc_time_names=ru_RU;
+select @@global.lc_time_names, @@lc_time_names;
+disconnect con1;
+connection default;
+--echo Returnung to default connection
+select @@global.lc_time_names, @@lc_time_names;
+set lc_time_names=default;
+select @@global.lc_time_names, @@lc_time_names;
+set @@global.lc_time_names=default;
+select @@global.lc_time_names, @@lc_time_names;
+set @@lc_time_names=default;
+select @@global.lc_time_names, @@lc_time_names;
+
+
+#
# Bug #13334: query_prealloc_size default less than minimum
#
set @test = @@query_prealloc_size;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 9771c5bc96e..620f292bc12 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -832,6 +832,7 @@ drop table t1;
#
create table t1 (col1 int);
create table t2 (col1 int);
+create table t3 (col1 datetime not null);
create view v1 as select * from t1;
create view v2 as select * from v1;
create view v3 as select v2.col1 from v2,t2 where v2.col1 = t2.col1;
@@ -938,7 +939,7 @@ insert into v3 (col1) values ((select max(col1) from v2));
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2));
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
-- error 1048
-insert into mysql.time_zone values ('', (select CONVERT_TZ('20050101000000','UTC','MET') from t2));
+insert into t3 values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
# temporary table algorithm view should be equal to subquery in the from clause
create algorithm=temptable view v4 as select * from t1;
insert into t1 values (1),(2),(3);
@@ -946,7 +947,7 @@ insert into t1 (col1) values ((select max(col1) from v4));
select * from t1;
drop view v4,v3,v2,v1;
-drop table t1,t2;
+drop table t1,t2,t3;
#
# HANDLER with VIEW
@@ -2220,6 +2221,8 @@ REPAIR TABLE v1;
DROP TABLE t1;
OPTIMIZE TABLE v1;
+ANALYZE TABLE v1;
+REPAIR TABLE v1;
DROP VIEW v1;
@@ -3214,3 +3217,5 @@ DROP TABLE `t-2`;
DROP VIEW `v-2`;
DROP DATABASE `d-1`;
USE test;
+
+--echo End of 5.1 tests.
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
index a4a1cefd0aa..b3bfd1cf544 100644
--- a/mysql-test/t/view_grant.test
+++ b/mysql-test/t/view_grant.test
@@ -356,25 +356,6 @@ drop view mysqltest.v3;
connection user1;
create view mysqltest.v3 as select b from mysqltest.t2;
-# give UPDATE and INSERT privilege (to get more privileges then underlying
-# table)
-connection root;
-grant create view, update, insert on mysqltest.v3 to mysqltest_1@localhost;
-drop view mysqltest.v3;
-connection user1;
--- error 1143
-create view mysqltest.v3 as select b from mysqltest.t2;
-
-
-# If we would get more privileges on VIEW then we have on
-# underlying tables => creation prohibited
-connection root;
-create table mysqltest.v3 (b int);
-grant select(b) on mysqltest.v3 to mysqltest_1@localhost;
-drop table mysqltest.v3;
-connection user1;
--- error 1143
-create view mysqltest.v3 as select b from mysqltest.t2;
# Expression need select privileges
-- error 1143
@@ -1040,5 +1021,154 @@ DROP DATABASE mysqltest_db2;
DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost;
+#
+# Bug#26813: The SUPER privilege is wrongly required to alter a view created
+# by another user.
+#
+connection root;
+CREATE DATABASE db26813;
+USE db26813;
+CREATE TABLE t1(f1 INT, f2 INT);
+CREATE VIEW v1 AS SELECT f1 FROM t1;
+CREATE VIEW v2 AS SELECT f1 FROM t1;
+CREATE VIEW v3 AS SELECT f1 FROM t1;
+CREATE USER u26813@localhost;
+GRANT DROP ON db26813.v1 TO u26813@localhost;
+GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost;
+GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
+GRANT SELECT ON db26813.t1 TO u26813@localhost;
+
+connect (u1,localhost,u26813,,db26813);
+connection u1;
+--error 1142
+ALTER VIEW v1 AS SELECT f2 FROM t1;
+--error 1142
+ALTER VIEW v2 AS SELECT f2 FROM t1;
+ALTER VIEW v3 AS SELECT f2 FROM t1;
+
+connection root;
+SHOW CREATE VIEW v3;
+
+DROP USER u26813@localhost;
+DROP DATABASE db26813;
+disconnect u1;
+
+#
+# BUG#24040: Create View don't succed with "all privileges" on a database.
+#
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+
+# Test.
+
+CREATE TABLE mysqltest1.t1(c1 INT);
+CREATE TABLE mysqltest1.t2(c2 INT);
+CREATE TABLE mysqltest1.t3(c3 INT);
+CREATE TABLE mysqltest1.t4(c4 INT);
+
+INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14);
+INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
+INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
+INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
+
+GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
+GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
+GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
+GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost;
+
+GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost;
+
+--connect (bug24040_con,localhost,mysqltest_u1,,mysqltest2)
+--echo
+--echo ---> connection: bug24040_con
+
+SELECT * FROM mysqltest1.t1;
+INSERT INTO mysqltest1.t2 VALUES(25);
+UPDATE mysqltest1.t3 SET c3 = 331 WHERE c3 = 31;
+DELETE FROM mysqltest1.t4 WHERE c4 = 44;
+
+CREATE VIEW v1 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW v2 AS SELECT * FROM mysqltest1.t2;
+CREATE VIEW v3 AS SELECT * FROM mysqltest1.t3;
+CREATE VIEW v4 AS SELECT * FROM mysqltest1.t4;
+
+SELECT * FROM v1;
+INSERT INTO v2 VALUES(26);
+UPDATE v3 SET c3 = 332 WHERE c3 = 32;
+DELETE FROM v4 WHERE c4 = 43;
+
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v12 AS SELECT c1, c2 FROM mysqltest1.t1, mysqltest1.t2;
+CREATE VIEW v13 AS SELECT c1, c3 FROM mysqltest1.t1, mysqltest1.t3;
+CREATE VIEW v14 AS SELECT c1, c4 FROM mysqltest1.t1, mysqltest1.t4;
+
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v21 AS SELECT c2, c1 FROM mysqltest1.t2, mysqltest1.t1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v23 AS SELECT c2, c3 FROM mysqltest1.t2, mysqltest1.t3;
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v24 AS SELECT c2, c4 FROM mysqltest1.t2, mysqltest1.t4;
+
+CREATE VIEW v31 AS SELECT c3, c1 FROM mysqltest1.t3, mysqltest1.t1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v32 AS SELECT c3, c2 FROM mysqltest1.t3, mysqltest1.t2;
+CREATE VIEW v34 AS SELECT c3, c4 FROM mysqltest1.t3, mysqltest1.t4;
+
+CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2;
+CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3;
+
+--connection default
+--echo
+--echo ---> connection: default
+
+SELECT * FROM mysqltest1.t1;
+SELECT * FROM mysqltest1.t2;
+SELECT * FROM mysqltest1.t3;
+SELECT * FROM mysqltest1.t4;
+
+# Cleanup.
+
+-- disconnect bug24040_con
+
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP USER mysqltest_u1@localhost;
--echo End of 5.0 tests.
+
+
+#
+# Test that ALTER VIEW accepts DEFINER and ALGORITHM, see bug#16425.
+#
+connection default;
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+ALTER VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo End of 5.1 tests.
diff --git a/mysql-test/t/wait_for_socket.sh b/mysql-test/t/wait_for_socket.sh
index 8c17c8ac0ac..2fa7d5c5b7e 100755
--- a/mysql-test/t/wait_for_socket.sh
+++ b/mysql-test/t/wait_for_socket.sh
@@ -61,7 +61,7 @@ fi
###########################################################################
-client_args="--silent --socket=$socket_path --connect_timeout=1 "
+client_args="--no-defaults --silent --socket=$socket_path --connect_timeout=1 "
[ -n "$username" ] && client_args="$client_args --user=$username "
[ -n "$password" ] && client_args="$client_args --password=$password "
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
index a10d54b5452..efdf0963b80 100644
--- a/mysql-test/t/windows.test
+++ b/mysql-test/t/windows.test
@@ -1,5 +1,6 @@
# Windows-specific tests
--source include/windows.inc
+-- source include/have_innodb.inc
#
# Bug 9148: Denial of service
@@ -49,3 +50,23 @@ execute abc;
execute abc;
deallocate prepare abc;
+#
+# Bug #26074 Mysql crash when creating partitions
+#
+
+CREATE TABLE t1 (
+ `pkid` int(11) NOT NULL AUTO_INCREMENT,
+ `SALES_DATE` date NOT NULL DEFAULT '0000-00-00',
+ KEY `pkid` (`pkid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+PARTITION BY RANGE (MONTH(SALES_DATE))
+(
+ PARTITION p0 VALUES LESS THAN (2) ENGINE=INNODB
+ data DIRECTORY='c:/tmp/'
+ index DIRECTORY = 'c:/tmp/',
+ PARTITION p1 VALUES LESS THAN (3) ENGINE=INNODB
+ data DIRECTORY='c:/tmp/'
+ index DIRECTORY = 'c:/tmp/'
+);
+
+DROP TABLE t1;
diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test
index 94b45fa249f..28abd3475d2 100644
--- a/mysql-test/t/xml.test
+++ b/mysql-test/t/xml.test
@@ -232,6 +232,13 @@ select UpdateXML(@xml, '/a/b/@bb2', '');
select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"');
#
+# Bug#27898 UPDATEXML Crashes the Server!
+#
+select updatexml('<div><div><span>1</span><span>2</span></div></div>',
+ '/','<tr><td>1</td><td>2</td></tr>') as upd1;
+select updatexml('', '/', '') as upd2;
+
+#
# Bug#16234 XML: Crash if ExtractValue()
#
SET @xml= '<order><clerk>lesser wombat</clerk></order>';